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
- Read both data sets into datatables.
- Create a row counter variable (int32), default value to zero.
- Use a ForEachRow activity on DT1.
- In the ForEach activity write
IF Row.Item(“Name”).tostring = dt2.Row(rowcounter)(0).tostring
ELSE messagebox(“Not Equal”)
Add an assign activity and increment the row counter
can you send me a picture of the process plz ?
CompareNames.zip (1.7 KB)
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.
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.
can you send me a picture plz ?
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
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.
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
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