How to use group by for excel

Hi guys,

i need to use group by method in linq or if you have much better idea of course you can informed me. I want to group of Semt / Mahalle. Each Different data separating different sheets. It is not logical but just i need so.
Do you know how to i do that.

This is my excel

Can you explain step by step ;
ex : - read range columng0
assign linq or smt else



Hope the following sample helps you.

dict = dt.AsEnumerable.GroupBy(Function(r) r("Semt / Mahalle").ToString).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable)

Sequence2.xaml (10.1 KB)


1 Like

Simply You Can Write it As ;

DT.Asenumerable.Groupby(Function(r) r(“Col_Name”).Tostring).Select(Function(g) g.Copytodatatable).Toarray

Output : Array of Datatable

By Using For each…You Can get each Datatable and By using write range you can write it in a particular Excel File.

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