Compare value of rows in same column and send email if condition met

In excel I have multiple rows which may contain information for the same user. I want to send an email to a single user with its single or multiple(if repeated) details from different row.

Hello You can use lookup data table for check the data from the excel

so It is the simplest way and one more way is there that is datarow use this also yo can achive

I hope you understand

Chethan P

Is it possible for you to elaborate on this?

Can you please elaborate your Question

Im not exactly looking up anything but comparing if value are repeated in different rows then adding that data for the same user instead of creating multiple mails for the same user

Can u share the screenshot of excel file please?

For same email address I don’t want rest of the values to be sent in separately. Rather in body of that email.

Hi @Sachit_MATHUR
you can try this way

  1. Read the excel file and store in dt1

  2. use the below assign activity

dt2 = dt1.DefaultView.ToTable(True,“E-Mail Address”)

Now use for each row to loop through each row of dt2

inisde the for each row , do the following,
use the below assign activity

dt3 = dt2.AsEnumerable().Where(Function(r) r(“E-Mail Address”).ToString.Equals(row(0).ToString)).CopyToDataTable

Now u will get a datatable having for email adress under dt3 for every iteration, now usemail activity to send the mail using same email adresss and different within it

Hope the information helps you

Nived N
Happy Automation

1 Like

Hi Nivedh,
Thank you. Can you also elaborate on selecting email address dynamically and then if values are repeated for a user how I can add them for that particular user?

People make things so complicated. Instead of that DT3 assign code, just use the Filter Datatable activity. This kind of thing is what it’s for.

1 Like

I don’t want to filter out the email addresses. I want the data of a similar email address and send it to the person. For eg occurs twice. So I want to mail once with a table containing both Sales doc numbers: 1159571,
created date: 3/11/2021 and 3/19/2021.
I hope this helps to understand my problem. Thank You

So You Need if email address is occur twice you have to check and send that duplicate mail id to the sales team right?

Yes, so as already explained, you create a DT of distinct email addresses. Then you loop through that DT, filter the original DT into a new DT of just the rows that match the email address from the loop, and send the email.

DT1 - all data
DT2 - just email addresses
DT3 - as you loop, you create this one from DT1, filtered on DT2’s email address value

No, I want to send the details all the details in the table to the email id. If duplicate email id i don’t want it to send multiple emails. I want it to add details in a single Email and send.

Then U have to remove the duplicate values from the table. use balareva remove duplicate value.
Then you can send the mail you can use if condition also but it took time
better remove the data from the data table.