Compare Two Excel Sheet from Different Folder

Hey @Palaniyappan

I have To Compare 2 excel sheets from Different Folder.If the Data is match nothing to do And if the data is mismatch Then We have to Write In an Another Excel i.e Your ‘X’ no. of data row is mismatch Please Check.

Thanks

1 Like

Fine
we can use JOIN DATATABLE ACTIVITY where pass the input of two datatables and get the resultant datatable with what condition we need

Cheers @omprasad

1 Like

We have lot of topics available on that @omprasad

First read the two excels and store them in data tables and then compare them using looping or check the below topics

https://forum.uipath.com/search?expanded=true&q=compare%20data%20tables%20status%3Aclosed

1 Like

When I match between 2 excel sheets.
I Removed some data from a column in the First excel Sheet to see it works or not.
But it gave a message that there is no mismatch.
I used if condition.
Datatable1.Rows(1).ToString = Datatable2.Rows(1).ToString
Then Use a Message Box
Thanks
@Palaniyappan @HareeshMR

1 Like

yah that would work either
Fine if we need to use loop
then hope these steps would help you resolve this
–use a build datatable activity and create a datatable with similar structure of these excel and get the output with a variable of type datatable named Finaldt
–use a excel application scope and pass the file path as input
–use a read range activity and get the output with a variable of type datatable named dt1
–now use another excel application scope and pass the file path of second excel as input
–now use a read range activity and get the output with a variable of type datatable named dt2
–use a for each row loop activity and pass the variable dt1 and change the variable name from row to row1
–inside the loop use another for each row loop and pass dt2 as input and change the variable from row to row2
–inside the inner loop use a if condition like tis
NOT row1(“yourcolumnname”).tostring.Equals(row2(“yourcolumnname”).ToString)
if this is true it will go to THEN part where we can have a ADD DATA ROW ACTIVITY like this with datatable name as Finaldt and arrayrow as row1.ItemArray or row2.ItemArray (based on our need)
where Finaldt is a datatable created from build datatable activity

–now use a BREAK Activity within this THEN part atlast to avoid looping again and again once after the match is found

–next to outer for each row loop use a write range from workbook activities and pass the filepath of excel where we want to enter the mismatch data and in the datatable mention the input as Finaldt and enable the Add headers property as well

hope this would help you
Cheers @omprasad

1 Like

I Got This Error.
Capture

1 Like

Fine
number of values passed in the ARRAYROW property is morethan the number of columns in your datatable
kindly check that once whether the datatable has that much number of columns or the right number of arrayrow is passed to the property

Cheers @omprasad

1 Like

Hey @Palaniyappan
Total no. Of row is 34 And Column is 11.
Thanks

no not that buddy
the number of values we have passed in the arrayrow property must be 11 that is
row1.ItemArray must be of count 11
to check that use a write line before to this add data row activity and mention like this
row1.ItemArray.Count.ToString
and check once with the output panel

Cheers @omprasad

1 Like

ya it’s 11
and it print all the data which is available in my 1st excel sheet

Thanks

1 Like

so does the error remains now
Cheers @omprasad

1 Like

Hey @Palaniyappan
Thanks For Your Help

I have Doubt On this.
Can We Compare these 2 excel sheets if the header format is different?
If not I hope This is the mismatch.

Header1 header2

1 Like

I hope they differ like one is applied with a filter while the another one is not applied with
That doesn’t matter when we are reading with read range we got an option in the property panel like UseFilter if it s enabled then it would take with the filter applied or else it won’t take the filter by default

Hope this would help you
Cheers @omprasad

1 Like