How to grouping data in excel and generate new file by each group?

I have an example data like this i would like to grouping it and generate into a new excel file
how can i do that?

see image at below

as you see at image i grouping by two columns (code column and location column) i don’t care data in item column.

thank you for helping me. So thank you very much if someone do example for me.

Hi @lovepong66

How about this expression

(From d In DtBuild.AsEnumerable
Group d By k=d("code").toString.Trim Into grp = Group
Let ra = New Object(){k,grp.First()(1),grp.First()(2)}
Select r = DtClone.Rows.Add(ra)).CopyToDataTable

Check out the XAML file

GroupGeneratedExcelfiles.xaml (12.5 KB)

Note : Kindly update the Column Names

Regards
Gokul

2 Likes

Hi,

How about using Dictionary as the following?

dict = dt.AsEnumerable.GroupBy(Function(r) Tuple.Create(r("code").ToString,r("location").ToString)).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable())

Sample20221114-2aL.zip (3.1 KB)

Regards,

1 Like

Hi @lovepong66 you can also do it by filter data table activity, here I am doing for one category. You can do it for others

You’re great!!! that what i need

1 Like

thank you for your reply it a good idea to do with this. Thank you very much

1 Like

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