How to Discard the row which has blank columns

How to Discard the row which has blank columns anywhere, i dont have the count of columns, so basically if the rows of something is blank then Discard the entire row

This is my input data

Hi @Chirag12 ,

From a Datatable manipulation point of view or assuming you have read the excel sheet as a Datatable, you can check with the below Expression :

DT = DT.AsEnumerable.Where(Function(x)x.ItemArray.All(Function(y)Not String.IsNullOrWhiteSpace(y.ToString))).CopyToDatatable

For handling errors on Direct CopyToDatatable, you can check the below :


We can retrieve: YourDataTable.Columns.Count

Option 1: nested loop

loop over rows

  • loop over columns: col in YourDataTable.Columns
    • check and mark row for deletion

As mentioned by @supermanPunch

Hey @Chirag12 ,

Take an assign activity
left side : YourDatatable variable
Right side:

(From row In YourDT.AsEnumerable
Where Not row.ItemArray.Any(Function (x) If(isNothing(x), True, String.IsNullOrWhiteSpace(x.toString.trim)))
Select row

Replace YOURDT with your Datatable variable

Hope it helps you!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.