Compare Two Excel files in Ui path studio X

Hello,

I have two excel files, and i need to compare both. If there is any data discrepancy then we need to Send the result via email.

I am working in Studio X

Thank you.

One of the simpler ways is to read each sheet using Read Range activities into two separate datatables. Next, use Output Datatable activities to convert the datatables to strings. Then, use an If condition to check that each string matches. If they do not, send the email indicating that there is a discrepancy.

However, if you need to note exactly where the discrepancy is, this gets more complicated. You would need to iterate over each row and column of one of the datatables and compare it to each field in the other datatable. This will take the process longer, but it means that you can identify specific differences between the files.

1 Like

So is this possible in Studio or in Studio X, because I am not able to locate read range activity option in Studio X

Hey @Pramod_Mangale

I hope you’re well.

There are a few ways you could go about comparing and analysing Excel files, two of the most common are:

  • Size
  • Contents

The way I compare the contents of a file is through a Python script that I have lying around (Happy to share if you’d like). It compares the number of tabs, tab names, tab contents. The similarities and differences are returned in a JSON structure (or dictionary) and the best part of all is that it is usable in UiPath through the Python Scope.

The easier way, is do as Anthony has suggested with the data tables in UiPath. It may be useful to check the size of the file before comparing each line.

Hope this helps! :slight_smile: