How to extract data from excel using LINQ,
here’s the spreadsheet,
challenge(3).xls (29 KB)
Expected Output :-
1 : a, b
2 : c, e
3 : d, g
4 : f
How to extract data from excel using LINQ,
here’s the spreadsheet,
challenge(3).xls (29 KB)
Expected Output :-
1 : a, b
2 : c, e
3 : d, g
4 : f
Thank you for the reply, @ranjith
there’s no any condition, it should extract all the data but,
here’s my Excel Data
and then it should display the expected output in Output Pane. (as i mentioned in my topic)
I am not sure how to achieve your problem using LINQ. Hope @arivu96 will help you on this.
(from x in DT_Input Group By Distinct = New With {Key .ID = CStr(x(“ID”))} Into Group From g In Group Select g ).copytodatatable
Using the above query you can group the rows with ID values. If you need i can help you to solve this without using LINQ.
Hi @samir
(From p In dt.DefaultView.ToTable(False,"ID","Role").Select Group p By ID=Convert.ToString(p("ID")) Into GroupA=Group Let x=GroupA(0)("ID").ToString+"|"+String.Join("-",(From p In GroupA Select Convert.ToString(p("Role"))).ToArray) Select dt.DefaultView.ToTable(False,"ID","Role").Clone().Rows.Add(x.ToString.split("|"c))).ToArray.CopyToDataTable()
Regards,
Arivu
@arivu96
hey thanks for the reply and you solved my problem.
i got the output like this…
could you please tell me… from where i can learn LINQ and practice queries,
I want to learn this because when i see these linq queries i get idea of how it works and for my learning I only make changes in that query so, is there any material or a link where i can learn this ?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.