Split DataTable based on two unique values


I have a datatable as below
I want to split this datatable based on Unique values from both column A and Column B as below
and so on.
Sample.xlsx (8.9 KB)

The input file might have more input than what shown in sample file.

Please let me know how to do this.

We can do it with help of group by

Assign Activity:
Left side: TableList | DataType: List(Of DataTable)
Right side:

(From d in YourDataTableVar.AsEnumerable
Group d by k1=d(“A”).toString.Trim, k2=d(“B”).toString.Trim into grp=Group
Select t=grp.CopyToDataTable).toList

Afterwards you can iterate with a for each activity and write out the tables to excel

Also have a look here:

Its working as expected. Thank you very much.

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