Comparision of two excel files and repalacing the compared data if found

Hi ,
How to compare and replace the excel file data
for ex: I have an excel data of new product details in this year and need to compare this with the previously obtained details which are in the another excel past year. now need to compare these two excels and if the data in the new excel is same as the data in the previous excel I want the replace the previous data with the new excel data details.
Before replacing the data ,I want my bot to ask for the auth(permission) whether to replace the data/not.

can anyone suggest me how can we do this???

1 Like

Hope we have two datatable a read from their respective excel files with READ RANGE activity named dt1 and dt2
—now use a for each row loop and pass the variable dt1 as input and change the variable name from row to row1
And use another for each row loop activity with variable dt2 as input and change the variable name from row to row2
—inside the inner for each row loop use a if condition like this
row1(“yourcolumnname”).ToString.Equals(row2(“yourcolumnname”).ToString
If this is equal it will go to THEN apart where
—we need to use a message box like do we need to replace or not and get the output with a variable of type string named str_output
—now use another if condition being inside the THEN part of previous If condition like this
str_output.ToString.ToUpper.Equals(“OK”)
If true it will go to THEN part where we can use a assign activity like like this
row2(“yourcolumnname”) = “the value you need”

Hope this would help you
Cheers @sreelakshmiV

We have a same topic today in the forum @sreelakshmiV

Hi @Palaniyappan
thankyou for the help

I’ve tried the same way ,but getting the error as below

1 Like

Fine
it was a type mistake here

it should be like this
row1(“yourcolumnname”).ToString.Equals(row2(“yourcolumnname”).ToString)

Cheers @sreelakshmiV