Quick way to compare two excel files

cant share xaml as its in AWS. However I am using this command, Dt1.AsEnumerable().Where(Function(row) NOT Dt2.AsEnumerable.Any(Function(x) x(“Value1”).ToString=row(“Value1”).ToString And x(“Value2”).ToString=row(“Value2”).ToString And x(“Value3”).ToString=row(“Value3”).ToString)).ToList().ForEach(Sub(row) row(“status”)= “UnMatch” row(“Action”)=“Amend”)

Hi @Shailesh123

I’m also facing syntax error. For time being, try this below code.

Dt1.AsEnumerable().Where(Function(row) NOT Dt2.AsEnumerable.Any(Function(x) x(“Value1”).ToString=row(“Value1”).ToString And x(“Value2”).ToString=row(“Value2”).ToString And x(“Value3”).ToString=row(“Value3”).ToString)).ToList().ForEach(Sub(row) row(“status”)= “UnMatch”)

Dt1.AsEnumerable().Where(Function(row) NOT Dt2.AsEnumerable.Any(Function(x) x(“Value1”).ToString=row(“Value1”).ToString And x(“Value2”).ToString=row(“Value2”).ToString And x(“Value3”).ToString=row(“Value3”).ToString)).ToList().ForEach(Sub(row) row(“Action”)=“Amend”)

Add one more line like above in your invoke code…!

Thanks!

1 Like

@kadiravan_kalidoss- any idea how we can use nested for each here ? Or pass initiate another row value and pass it within For Each. Something like .ToList().ForEach(row(“Action”) = x(“Action”))

Hi @kadiravan_kalidoss - Hello, can these code be used also if I compare 2 different excel file? I noticed in the scenario above, the comparison came from 2 tabs in 1 excel file…

Hi @redbee,

Yes , we can compare data from 2 different excel file. Read the excel files separately and pass the datatable into invoke code activity.

Thanks!

1 Like

Hi I have two excel files, I need to compare all cells in Excel1 that is not null to Excel2. I have to check if that input matches.

use Excel application scope for this write range. it will work only inside the scope.

or use this activity directly.

this will work without scope.

Thanks!

Hi @kadiravan_kalidoss - i tried and tried for this approach but it doesnt work , so had to go with Vb Script

Hello, thanks for assistance :slight_smile:

I just want to ask what might be the issue if I have this error on my Invoke Code?

Invoke Code: Exception has been thrown by the target of an invocation.

I used the same code above, just changed the “Value 1” on my own row names.