Comparing two sheets in excel

i want to compare two sheets in excel, i.e, sheet2 first column with sheet 1 first column. In case if it satisfies i have write sheet 2 second column values to sheet 1 second column. i cant use column name to compare and cant use for each loop. can someone help me with it

Hello @shishirshetty2701,
Please kindly look here:
https://forum.uipath.com/search?q=compare%20excel%20status%3Asolved
You may find a lot of topics about comparing excel sheets, columns etc. :wink:

3 Likes

Buddy kindly follow the below steps that could help you resolve your issue

–use excel application scope and pass the file path of first file as input
–use read range activity and get the output as a variable named out_dt1 of type datatable
–again use excel application scope and pass the file path of second file as input
–use a read range activity and get the output as a variable named out_dt2 of type datatable
–make sure that the two datatable variable scope in the variable panel is mentioned with whole sequence name
–then use a for each row loop and pass the first variable out_dt1 and use another for each row loop within the first one and pass the second variable out_dt2, change the variable of second for each row loop from row to row1 (to avoid error with first for each row loop as they have the same variable row)
–now inside the second for each row loop use a if condition like this
row1(“Columnname”).ToString.Trim.Equals(row(“Columnname”).ToString.Trim)
if this condition gets satisfied it will go to THEN part of if condition where we can assign the value of column2 like
row(“SecondColumnname”) = row1(“SecondColumnname”).ToString
and add a break activity next to this assign activity to avoid iterating once after getting matched…
–finally outside these two for each row loops, use a write range activity and pass the variable out_dt as input and the sheet name where you want to enter this data
Thats all buddy
Kindly try this and let know whether this works or not
Cheers @shishirshetty2701

Cheers @shishirshetty2701

@Palaniyappan : I am matching the value and writing in message Box as pass or fail.
I have 4 value (Pass ; Fail ; Pass ; Fail).

I am getting Output as : Pass ; Fail ; Fail : Fail.
Please let me know where I am wrong.

Regards,
Zahid