How to find blank rows


#1

how to find whole blank row from a excel sheet


#2

Hi there @mhk15,
Do you only want to retrieve the blank rows from a document, or do you want to remove them?

If you want to remove the rows without data (for a certain field), then you can extract the whole Worksheet and filter, using:

dtMyExtractedData = dtMyExtractedData.Where(Function (drRows) String.IsNullOrWhiteSpace(drRows.Item("ColumnToCheck").ToString)).CopyToDataTable

Please let me know your specific requirements.

Thanks once again,
Josh


#3

Hi @mhk15,

Refer this link
DataTable

Regards, Arivu:-)


#4

Hi @mhk15,

Using below code you can get the all the empty rows
DataTableName=DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(""))).CopyToDataTable()