Comparing the excel sheets in different datatable

Hi everyone,
I have an invoke workflow, in that workflow i am saving the data into an excel sheet
now i have another excel sheet with same data as invoke excel but in one of my column some rows are different now i want to compare the two excel sheets and place the data into second excel sheet
now i want know how can i get access to the invoke excel sheet
i had invoked workflow then readrange for reading the another excel sheet and for each rows
in for each row if i am using invoke workflow datatable then it is getting error datatable is not declared
i had imported the arguments of invoke workflow also
i want to know how to use that datatable of invoke workflow
help me out in these

1 Like

@Manisha541 Please be more precise and specific what is troubling you. In the post it seems you are facing multiple issues to which you need help for.

Please try putting some code snippet or put your question in bold or things that you have tried in steps so that it is more clear to understand. Thus community can help you resolve your issue.

1 Like

how can i pass invoke workflow datatable to the for each row @anoopap @samir

1 Like

Basically if you want to compare data between two excel sheets, then using read range activity fetch data of both the sheets in 2 different datatable.

Then you can merge them using the merge datatable activity into your final DataTable.

1 Like

@JDoshi In one excel i have total1 column which is in data table dt and i have total2 column which is in another datatable db i have used to for each rows inside one another now in if activity
i want to compare these columns how could i write the code for it

1 Like

Hi @Manisha541

Can you please elaborate your issue so that I can help. I’m bit confused here.

1 Like

Inside two for each row activity, you want to check the column values by using the Row variable, which is from two for each row activity.
Eg: First, for each row activity row as Row1 and 2nd as Row 2
In IF activity,
If Row1(0) = Row2(0)
Print Row1(0)
else
Print Row2(0)

Row1(0) as Column 0 in 1st Excel file
Row2(0) as Column 0 in 2nd Excel file

Thank U
:slight_smile:

1 Like

Hi @Manisha541

How your Data Table db looks like ?

1 Like

img.xslx file is the output of db datatable it is of extracting the data from image yesterday workflow u have designed the same one

1 Like

Hi @Manisha541

Try this one Main (3).xaml (10.7 KB)

and replace first read range with your invoke workflow

1 Like

getting error in second for each row datatable db object reference not set to an object @anoopap

1 Like

Hi @Manisha541

Could you please check if the column names are correct or data table is not empty.

1 Like

Hi @Manisha541,

What do you mean by comparing 2 sheets data, do you want to fetch unmatched rows??
It’ll be easy to get it, if you tell the expected output.

1 Like

iwant the matched data into one column and the data column we took to compare and the output should be in another excel how can i do it @samir

1 Like

like colum1 amount and column 2 amt and the ouput it is matched or not in one column u can see i used build datatable but i am not getting to save the matched data into it how can i pass that value into build data table

1 Like

@Manisha541,

Correct me if i’m wrong, you want to compare value of column first and second, if they’re exact then write matched in next column otherwise unmatched right?

1 Like

yes comparing two columns,i had did it i just want to write the compared colums and output into on excel sheet

1 Like

Create one DataRow variable and assign your datatable.NewRow before your process activities placed .then assign your matched values to the datatable column by using DataRow (i.e DataRow(“ColumnName”) and put add data row activity in the last but inside the loop and assign datatable to write range in outside the loop.

1 Like

Assign your values to DataRow(like DataRow(“Status”) = “Matched” ) as I previously said.In Add DataRow activity you have to assign DataRow variable in DataRow Label and assign BuildDataTable Variable in Datatable label.

1 Like

@Manisha541
Okay then, for that you use filter data table activity and using output columns tab you can mention selective columns, so mention those column names and then using write range you can able to write it that filter datatable in excel sheet.

1 Like