Compare two cells from two different excels

Hi,
i have an assignment at work and i need to compare some cells from a certain excel with another cells from another excel. The cells are all from the same column.
For example IF cell D3 from excel1 is not present in any cell in column D in excel 2 THEN new row and insert excel.D3 in column D.

The problem is that the excel1 is scraped from an email and the excel2 it’s a file that i already have. I’ve managed so far to extract and put the data from the email but i don’t know how to compare the two things.

That’s the scraped table

That’s the file where i need to search the cell
Excel%202

So you say it is scraped from an email.

Is it within the email body or an excel attachment?

If it is a email body, you can convert HTML tables to Datatables using this

This will then allow you to access the data correctly.

You can then loop through each row (FOR EACH ROW) to see if the value is included in the list . If not then simply add datarow to your datatable, then write back the datatable to the file at the end.

I’ve already converted it in datatables and i put it in an excel file. Right now i have the two excel and i can work on them. i need to loop (i think :joy:) on the column it’s delf not the row. Because i need to check if every cell in column D ( the first picture) is present or not in column G( the second picture). So it’s like D3== G1 OR G2 OR G3… until the rows are finished. And i don’t know how to do it. Just trying to explain more. (By the way thanks a lot you are very fast to reply @TimK)

Hi,

the topic is discussed multiple times, you can do a search and get it.
I would say use a linq query(dt.select, refer other posts to get the format) and that will do the job for you.

Let us know if it helps.

Regards,
Pavan H

2 Likes

OK cool, wasnt fully sure from your original post.

There are two was to do it, either use a For Each Row and Datatable.Select to check if that value exists.

or as @pavanh003 mentioned use LinQ to retrieve the specific data (there are plenty posts on the forum specifying LinQ queries

Ok thanks a lot. Just where i can learn the use of database.select method? thanks again

2 Likes

Ok so that’s what i’ve got so far.
Cattura1 Cattura2 Cattura3

and i get this error

Cattura5

those are the propertis of read range

Cattura6

tried even putting the range but it’s the same result. :upside_down_face:

Also another question, but off topic, can i extract a structured data table from a .msg file?

For your Object Reference error - try adding in logs of information you are trying to utilise.
i.e. log cell1 variable etc.

Also FattDT.Rows(6) will only give you the full datarow - If you are trying to get column G (Index 6) you would access like this: FattDT.Rows(X).Item(6).Tostring

X is the row number / Item(6) is the column index.

I would advise doing all of the logic within UiPath and not use excel until the very end as it will be more efficient.

You already have both tables within UiPath Memory (datatable variable)

Once you have updated the relevant datatable values then write append or write range.

check if this helps. you can use “Except” or “Intersect” based on need.

Sorry I didn’t understand. What do you mean by adding logs of information?

Thanks in advise :slightly_smiling_face:

Thank you @keerthims your workflow will surely help, but my task it’s a bit different it’s like if the values of table1(column D) aren’t present in table2(column G) then add in table2 a new row in column G the value in table1 that is not present. I know i’m not explaining my self very well but it’s a bit complicated :sweat_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.