Hello,
Can we split the excel sheet data like i have highlighted with yellow color.
Read the Complete sheet
Spit the TableName as sub tables based on Respective TemplateName.
Key is template Name
Value is Datatable
Is there any LINQ for this Scenario.
Input File -
InputData.xlsx (12.1 KB)
Thanks & Regards
Soundarya
subtables = excelData.
GroupBy(Function(row) row.TemplateName).
ToDictionary(Function(group) group.Key,
Function(group) group.ToList()
Try this
Yoichi
(Yoichi)
September 27, 2023, 7:28am
3
Hi
Can you try the following sample.
dict = dt.AsEnumerable.Select(Function(r,i) Tuple.Create(dt.AsEnumerable.Where(Function(r2,j) j<=i AndAlso r2(0).ToString<>"").Last() ,r)).GroupBy(Function(t) t.Item1.Item(0).ToString).ToDictionary(Function(g) g.Key,Function(g) g.Select(Function(t) t.item2).CopyToDataTable)
Sample20230927-7L.zip (10.7 KB)
note : dict is Dictionary<string,DataTable>
Regards,
Thankyou for quick response
Let me check