Looking for Linq Query

Hi , I have an excel sheets having 1 lakhs (attached Input Sheet as an example) + rows and 30 columns. I need to create output sheet based on input sheet as attached. I need to have only one record for every material code as per output sheet. Can some one please help me here? I believe Linq will be better from performance point as I am having huge data

Input Sheet.xlsx (8.2 KB)
Outputsheet.xlsx (8.1 KB)


Can you try the following sample?

dt.AsEnumerable().GroupBy(Function(r) r("Matrial Code").ToString).Select(Function(g)
    dtResult.Rows.Add({g.Key}.Concat(Enumerable.Range(0,dtResult.Columns.Count-1).Select(Function(i) "0")).ToArray)
    End Sub
Return g
End Function).ToList()

Sample20220107-2.zip (14.9 KB)


Thanks Yoichi this worked :slight_smile: can you please explain me dot net code that will really help me in future. Thanks once again

1 Like

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