Compare 2 excel data

Hello Friends,

Everyday I have to export current day excel from portal and have to check “Case” in yesterday excel file, if case found then delete that record from current day excel file.

This is the query. Attaching sample excel files.
Please help
04112024.xlsx (8.6 KB)
01112024.xlsx (6.0 KB)

@Jeeru_venkat_Rao,

Any error or specific issue you are facing while working on it?

@Jeeru_venkat_Rao Check sheet names

Sheets name is correct, dd/mm/yyyy format

Not have any logic yet, I am trying lookup data table.
Looking for linq query

Hi @Jeeru_venkat_Rao,

I have attached a XAML with the LINQ query, hope this helps!

Main.xaml (10.7 KB)

Read DataTables:

Use Excel Application Scope activities to read the two DataTables (DataTable1 and DataTable2) using Read Range activities.
Use LINQ to Find Matching Rows:

matchingRows = (From row1 In DataTable1.AsEnumerable()
Join row2 In DataTable2.AsEnumerable()
On row1(“ColumnName1”) Equals row2(“ColumnName1”) And row1(“ColumnName2”) Equals row2(“ColumnName2”)
Select row1).ToList()

Replace “ColumnName1” and “ColumnName2” with the actual column names you are using.

Remove Matching Rows:

Use a For Each activity to loop through the matchingRows list and remove each row from DataTable1.
For Each row In matchingRows
DataTable1.Rows.Remove(row)
Next

@Melroy_Dsa - Bro this xaml is not opening, can you re-share it.

ComparingExcel.zip (62.0 KB)
Try this

Thank you @Melroy_Dsa
Its working fine.

1 Like

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