When Comparing two Excel getting wrong Output

Hi all,

When Comparing two Excel (2X2): A & B getting wrong Output. i was doing everything Correctly but not sure where i went wrong. Sample data below

Excel A:

AName ALocation
Vicky Offshore
Ganesh Onshore
Moni Offshore
Raj Offshore

Excel B:

BName BLocation

Here i want to update the “Location” of Excel B. So, I have used two Read activity for excel A and Excel then used Nested “For each row” and Compare the Name of Excel A & B

If {

(Add Cell Activity) row.item(BLocation).ToString

Finally Output is Reflecting wrongly… I am not sure where i am going wrong correct me please (No Error)

send me xaml file then i will send you correct xaml after updated that one.
on sg2070156@gmail.com

Hi @Jayavignesh_G

The column name must be within quotes like this → row.Item("AName")


Try to use Join Datatables activity as below

Hope this may help you


Name are already in Double Quotes Only…

But how it will help me to write “BLocation” in ExcelB ?

@NIVED_NAMBIAR @Palaniyappan or any Master’s

Kindly help me out in this… :worried:


Check below for your reference

TwoSheetsWrite.zip (986.0 KB)

Hope this may help you


Main.xaml (12.0 KB)
let me know, if any doubt

Hi @Jayavignesh_G
I think when u are two loops [nested loops], if the current item for each loop is denoted by same variable, may be there would some issue around, I think that would be issue around
I corrected that and it is working fine for me
check this one
Main.xaml (13.9 KB)

Well you can try this method in invoke code activity
Main.xaml (11.0 KB)
data.xlsx (9.2 KB)

  1. Instead of using nested loop, try with lookup datatable activity, it would be simple around
    Main.xaml (12.2 KB)

[same data , data.xlsx, is used for all]

These are different methods that u can try

Nived N
Happy Automation

1 Like

@NIVED_NAMBIAR … Seriously you are great. Hats-off to your knowledge Sir. You are simply Mind blowing sir !! i need to learn more from you sir… Please reply to my post where ever i was mentioning you or Is there any way to contact you please !!! I need to learn more VB Code from you sir…

Solution 2 - Worked for me.

1 Like

Hi @Jayavignesh_G

Don’t you get the same result with Solution A and Solutions B

Yes… I got Solution by using method 2

1 Like

@NIVED_NAMBIAR I was not able to Write on the excel When Pivot Table is Created Can you please help me with any Solution for that ?? Do i need to open New Question in forum or Will help me here ??

Error:" index was out of range. must be non-negative and less than the size of the collection"

FYI- When i was write without “Pivot” Sheet (Sheet Which have Pivot Table) no error.

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