Hi Everyone, I want to remove the duplicate records in an Excel file by comparing the values of 2 columns and only keep unique records,
here is the file now I want to remove Duplicate records from the file where Invoice number and Supplier Number column values are same. Ex. in the pic I want to remove 4th row as row 3 and row 4 have same supplier and invoice number. Rest the data will be kept as it is
Can someone please provide me the query
1. Read Range (Output: DataTable)
2. Assign uniqueRows = (From row In dataTable.AsEnumerable()
Group row By key = New With {Key .Column1 = row.Field(Of String)("Column1"), Key .Column2 = row.Field(Of String)("Column2")} Into Group
Where Group.Count() = 1
Select Group.First()).CopyToDataTable()
3. Write Range (Input: uniqueRows)
dt_Output = (From row In dtInput.AsEnumerable()
Group row By Key = New With {
Key .Column1 = row.Field(Of String)("Column1"),
Key .Column2 = row.Field(Of String)("Column2")
} Into Group
Where Group.Count() = 1
Select Group.First()).CopyToDataTable()
dt_Output is of DataType System.Data.DataTable
Hope it helps!!
dt_Output = (From row In dtInput.AsEnumerable()
Group row By Key = New With {
Key .Column1 = row.Field(Of Double)("Column1"),
Key .Column2 = row.Field(Of Double)("Column2")
} Into Group
Where Group.Count() = 1
Select Group.First()).CopyToDataTable()
here is the file now I want to remove Duplicate records from the file where Invoice number and Supplier Number column values are same. Ex. in the pic I want to remove 4th row as row 3 and row 4 have same supplier and invoice number
dtExtractedText = (From row In InputDt.AsEnumerable()
Group row By Key = New With {
Key .InvoiceNumber = row.Field(Of Object)("Invoice Number"),
Key .SupplierNumber = row.Field(Of String)("Supplier Number")
} Into Group
Select Group.First()).CopyToDataTable()
uniqueRows = (From row In dataTable.AsEnumerable()
Group row By key = New With {Key .Column1 = row.Field(Of Object)("Invoice Number"), Key .Column2 = row.Field(Of String)("Supplie Name")} Into Group
Where Group.Count() = 1
Select Group.First()).CopyToDataTable()
@Parvathy@lrtetala@rlgandu please share with me the screenshots of the arguments passed and properties I am not able to open the workflows which you shared