How to find blank rows

how to find whole blank row from a excel sheet

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,

Hi @mhk15,

Refer this link
DataTable filtering with expressions

Regards, Arivu:-)

1 Like

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()

1 Like