Compare 2 unstructured csv files on search criteria

I have 2 unstructured CSV file containing similar kind of data (sentence formation is different like 1. Ambulance=$200 2. Price for Ambulance=$200 per ride) I want to extract the column on the bases of Ambulance.
I was thinking to select one row from 1st CSV file and traverse whole 2nd CSV. If search contains the element it prints the result in 3rd output CSV.
Is it possible or is there any other way to solve this?


Good evening Jagat,

Are you able to scrub any proprietary data from the CSVs and share a sample/example with us?


Here are two excel images which i am comparing


Currently it is comparing only the structured data only

1 Like

Welcome to uipath community
—hope these steps would help you resolve this
—use a excel application scope and pass the file path of the first excel file
—inside that scope use a read range 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 file and insid ether scope use a read range activity and get the output with a variable of type datatable named dt2

—now use a for each row activity and pass the first datatable dt1 as input and change the variable row to row1
—inside this loop use another for each row loop and pass the second datatable dt2 and change the variable row in for each row loop to row2
—inside the inner for each row loop use a if condition like this
row2(0).ToString.Contains(Split(row1.ToString,” “)(0).Tostring.Trim) AND row2(1).Tostring.Trim.Equals(row1(1).ToString.Trim)
If this is true it will get into THEN part where we can use a message box or write cell activity from workbook activity with the input value we want

—make sure that in the THEN part we have added a break activity at last so that it won’t loop again and again if the match is found

That’s all you are done
Hope this would help you
Cheers @Jagat_Kishore_Mishra


If you have .xaml file sample can you share ?


Sorry buddy
I don’t have my lap now
Kindly try this or no worries we can solve this together
Let us know if you were facing any challenges with that

Cheers @Jagat_Kishore_Mishra

1 Like

Tried the solution but not working it is not writing any output


Sorry for the delayed response
—we are good till if condition
—from there we need to make some changes
—as you said we need to enter the result in a new excel
—so let’s do one thing. In the very beginning of the sequence use a Build Datatable activity and create a datatable with same number of columns as we have in these two excels and get the output with a variable of type datatable named Finaldt
—now let’s get back to the changes to be made inside the IF condition
—here we have used excel application scope. So instead of that inside the THEN part use a Add data row activity and in the property panel mention the datatable as Finaldt and in the ArrayRow mention as row1.ItemArray

This will add the datarow to the Finaldt datatable that gets matched with the condition

—now next to this outer for each row loop with variable row1 use excel application scope and mention the file path where we want to enter the result
—and inside the scope use a write range activity and mention the datatable as Finaldt and sheetname where we want to write and range as “”
Make sure that the Add Headers property in the property panel of write range activity

No worries
Hope this would help you
Cheers @Jagat_Kishore_Mishra

1 Like

this is what i have created it is working fine but the comparison is failing . Need excel formula to fetch the correct data

temp.xlsx (12.1 KB)

Can any master help ?