Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all articles
Browse latest Browse all 448

Commented Unassigned: Dataset contains blank rows [13289]

$
0
0
I am using Excel Data Reader 2.1.2.0. In dataset I get a lot of blank rows that are obviously blank rows in excel.
How can I filter blank records? Is there any out of box functionality in excel data reader?
Comments: ** Comment from web user: pranavq212 **

I ended up removing empty rows from dataset like:

foreach (DataTable source in result.Tables)
{
for (int i = source.Rows.Count; i >= 1; i--)
{
DataRow currentRow = source.Rows[i - 1];
foreach (var colValue in currentRow.ItemArray)
{
if (!string.IsNullOrEmpty(colValue.ToString()))
break;

// If we get here, all the columns are empty
source.Rows[i - 1].Delete();
}
}
}
result.AcceptChanges();


Viewing all articles
Browse latest Browse all 448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>