Send Email based on

Hi,

I want to create html table and send each different row as HTML table and to send the email body/content based on each different email recipients.
eg.

To: Abc.example.com
Subject: Story
Email content:

Hi.

Refer to table below.

Title Story Start Date Closing Date Remark
Lion Animal 20 Jun22 30 Jun 22 -

The next record to send will be different as above as table will change and email recipient will change too. eg:

To: XYZ.example.com
Subject: Story
Email content:

Hi.

Refer to table below.

Title Story Start Date Closing Date Remark
Cat Cat Animal 2 Jan22 30 Apr 22 2 months

They are to read from excel file with the headers:

Title Story Start Date Closing Date Remark Email Address

So what’s the challenge you are facing here please ? @yhlll

The challenge is how to send to the correct email recipient based on row by row entry. What encountered issue is that it send the whole html table ( all rows) as email body to all email recipients and not individual email recipient specified in row.

So @yhlll Each row has its corresponding recipients listed ?

Yes, each row will have corresponding recipients.

So @yhlll

You can do the following please,

  1. Read Range the table from the Excel

  2. Loop the table using ForEachRow

2.1 Use Generate Data Table activity where you pass the first column content [CurrentRow(0).ToString] as input and get the output as table

2.2 Pass the above table to DT to HTML table activity (can be downloaded from marketplace.uipath.com) which gives you an output of HTML table code

2.3 Now use any of the Send email activity with email recipient as 2nd column value [CurrentRow(1).ToString]

Hope this helps

Thanks
#nK

Hi ,

When can I download the find the DT to HTML table activity ?

That’s not an automation step, you need to download and install to build your code.

Link - Download RPA Listings - RPA Snippets, Workflows, Connectors | UiPath Marketplace

Hi,

File is downloaded but how to import into it? Thanks.

Please go to manage packages in the Studio & Enable marketplace from which you can install the package directly.

Hi Nithinkrishna,

Try to find the packages in marketplace but it was not there.

There is a bunch of them :sweat_smile:

One more for you - Xebia - DataTable to HTML Table Conversion - RPA Component | UiPath Marketplace

Hi,

Manage to download the packages. To clarify the command: “ForEachRow” is this from Datatable or excel?

You will need to Read Range from Excel into a datatable and use that data table in ForEachRow

Hi,

The header becomes Column 1…Column2. etc. My excel header has the Headername, bit after running RPA, the header becomes Column 1…Column2. etc.

Also notice that the Start Date details is shifted forward, it split into Column 2 for the date. How to adjust to the correct holder?

image

Hey @yhlll

While you read the Excel are you using Add Headers option ?

Thanks
#nK

Hi Nithinkrishna,

It is default check for Add Headers option.

What about the Write Range ?

Hello @yhlll

If your datattable is having header row and you need to retain that while writing to excel, then enable the Add Header property in the Write Range activity.

Thanks

Hi Rahul,

The file is read only so using Read Rang and no Write Range.