How to remove empty values row in datatable?

need to remove the row which is empty in all columns expect first columns.

for example datatable,
remove row is 16-30,30 Above,8-15 (because they are empty in all columns)

Date column1 column2 column3 column4 column5 column6 column7
1-3 17 10 15 4 47 15 56
16-30
30 Above
3-7 9 4 3 14 4 1
8-15
Total 26 14 18 4 61 19 57

Hi @saninfo273

Use Filter DataTable activity

Output:

Cheers!!

@saninfo273

Assign activity:
    filteredDataTable = (From row In yourDataTableVar.AsEnumerable()
                         Where Not row.ItemArray.Skip(1).All(Function(x) IsDBNull(x) OrElse String.IsNullOrEmpty(x.ToString.Trim))
                         Select row).CopyToDataTable


Input:

Output:
image

Hi @saninfo273

Try this in Assign activity:

Save To: dt

Value To Save: dt.AsEnumerable().Where(Function(row) Not row.ItemArray.Skip(1).All(Function(cell) cell Is DBNull.Value OrElse String.IsNullOrWhiteSpace(cell.ToString()))).CopyToDataTable()

Regards

2 Likes

Hi @saninfo273

and then write range workbook

Hi @saninfo273

Try this:

DT.AsEnumerable().Where(Function(row) Not row.ItemArray.Skip(1).All(Function(x) IsDBNull(x) OrElse String.IsNullOrEmpty(x.ToString.Trim))).CopyToDataTable()

Hope it will helps you :slight_smile:
Cheers!!