Is is possible to compare two Excel files and extract the data that is in excess?

Hello, could anyone tell me if it is possible to compare two Excel files? In the case I am extracting a file from the network (it cannot be modified) creating a “control” file and a “backup” file, the “control” file extracts the data in real time from the original file and then must be compared with the “backup” (old file), the lines that are added in the “control” file must be inserted in the “backup” file. Someone might ask why not simply copy the control file in the backup, but if someone accidentally changes the spreadsheet we run the risk of losing the backup. The idea is just how to extract the lines added in the control, so you can insert them in the other worksheet.

Hey @pedro.azevedo

You can just read the Excel data and append it to the backup - will that work ?

Or there is a chance of duplication ?

Thanks
#nK

@pedro.azevedo, Are the new lines added to the control file sequentially at the end of the table? if yes, I think you can play with the row numbers to calculate the range of new lines. Then use “Read Excel Range” and “Write Excel Range” to write the new lines in the backup spreadsheet.

No @nmnithinkrishna, because I need to make the difference between the two files to insert only the new data.

@dm.ferreyra I forgot to mention it, but new data is only inserted after the robot runs. They are manually entered into the original sheet (which cannot be edited by the bot).

1 Like

When we do these comparison between spreadsheets, we usually loop every line of the Excel number 1 searching the data in a loop with every line of Excel number 2.

It works, we lose a lot of time but I don’t know if we have a better option.

Hi Pedro,

Did you find a solution for your case? as Daniel said I believe a way to do it would be looping in an excel, comparing with the other one. You could do it by using the “For each row” activity or Read the Excel and compare the variable which it is saved to.

2 Likes

Yes, I changed my plans, and I used a “Read Excel Range”, first I created a txt file to store the last line of last execution. After I created a assigned and compare last execution with my “new” table, after that I used read excel range to use only new dates. It’s a little bit more complex but I tried to summarize it.
Thanks @dm.ferreyra, @Daniel_Reche and @Daniel_Reche

2 Likes