Remove row prior to reading into data table


#1

I have to read a spreadsheet where the column headings may be in first or second row.

If cell A1 is blanks, delete Row 1.

How can I remove the first row prior to reading the entire sheet into a data table? I do not want to have to keep track of whuch row the headers were in.


#2

Hi @rlwalters,

use this code to remove all column empty in the row.

DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(""))).CopyToDataTable()

Getting First row from the removed empty rows and create a new table from that, refer below xaml file to achieve.

Datatable.xaml (15.1 KB)

Regards,
Arivu