Who can i compare 2 excel file plz?

Who can i compare 2 excel file plz ?

what kind of comparison? cell by cell? using a key? all columns?

search if the name in the excel 1 are in the excel 2

Screenshots would be helpful so we can see the datasets.

the names will be in the first column of the 2 excel

  1. Read both data sets into datatables.
  2. Create a row counter variable (int32), default value to zero.
  3. Use a ForEachRow activity on DT1.
  4. In the ForEach activity write

IF Row.Item(“Name”).tostring = dt2.Row(rowcounter)(0).tostring

THEN messagebox(“Equal”)

ELSE messagebox(“Not Equal”)

Add an assign activity and increment the row counter

2 Likes

can you send me a picture of the process plz ? :slight_smile:

@ronanpeter

CompareNames.zip (1.7 KB)

1 Like

Thank you but how can i select the excel file 1 and 2 plz ?

Use Excel Application Scope activity to read the data from each file.

1 Like

so i need to replace Generate Data Table by read ?
Can you send me a picture plz ?

Yes, replace those. They are just there to provide an example. As long as you have your data in two separate datatables, you are good to go.

1 Like

can you send me a picture plz ?

I am in the good way ? but when i want to put dtTable1 as a workbook it doesn’t work

make sure the variable type for dtTable1 is system.data.datatable and that the scope allows for you to use it in that place. also, place the output to dtTable1 at the ReadRange activity, not the Excel Application Scope

1 Like

Idid what you wrote, now i have this :

Ok, so in the IF condition, I have a string called “Col1”. Replace this with the name of the column in your dtTable1 you are grabbing the values from, or you could replace it with the column index number.

Do the same in the Message boxes.

1 Like

This is the excel 1 : The colomn i want is the first one

This is the excel 2 : The colomn it will search the name is in the first one

image

Ok i tried your solution but i have something not logique

The message box said : Name 1 is not equal to Name 2 (I don’t understand??)

What i what is when it find a name in the exel 1 and 2 the cell of the excel 2 will be red