Hello Team i have a query related to Excel i am having multiple data on a column so i want to pick only one from that multiple value and also unique value from them.
Thanks in Advance…
Hello Team i have a query related to Excel i am having multiple data on a column so i want to pick only one from that multiple value and also unique value from them.
Thanks in Advance…
You got two options here:
Method 1: Using DefaultView.ToTable
Read Range activity to read your Excel sheet into a DataTable, say yourDT.yourDT = yourDT.DefaultView.ToTable(true, "ColumnName")
Method 2: Using LINQ and GroupBy
Read Range to load your Excel data into a DataTable.DataTable with unique values:yourDT = yourDT.AsEnumerable().GroupBy(Function(r) r.Field(Of String)("ColumnName")).Select(Function(g) g.First()).CopyToDataTable()
This method uses LINQ to group by the column values and selects the first unique occurrence.
LLM helped me to rephrase the answer but it’s validated by me
Hey @prashant1603765 thanks for the detailed steps.it really helped me out. ![]()
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.