I have situation where I have to delete duplicate information in an Excel file for two columns A and C (Member ID# and Last Name) using only Workbook activities. Excel application should not be used. Kindly help!
dt1.AsEnumerable.GroupBy(Function(a) Tuple.Create(a(0).ToString,a(2).ToString)).Select(Function(grp) grp.First).copytodatatable
Hope this helps
Read the excel data and use the below LINQ
// Assuming 'dt' is your DataTable
dt = dt.AsEnumerable().GroupBy(Function(x) New With {
Key .MemberID = x.Field(Of String)("Member ID#"),
Key .LastName = x.Field(Of String)("Last Name")
}).Select(Function(g) g.First()).CopyToDataTable()
Or You can use Filter activity.
or you can follow below
Change the type to double or in x.Field(Of String)(“Member ID#”)
I guess you are getting hear
// Assuming 'dt' is your DataTable
dt = dt.AsEnumerable().GroupBy(Function(x) New With {
Key .MemberID = x.Field(Of Double)("Member ID#"),
Key .LastName = x.Field(Of String)("Last Name")
}).Select(Function(g) g.First()).CopyToDataTable()