aaydin
(Ahmet Aydin)
January 25, 2021, 9:07am
1
Dear all,
I am struggling in creating a robot which sends emails with information based on the receiver email address in a Excel table.
Each receiver needs to get only one email with his/her information.
Thank you very much in advance!
ppr
(Peter Preuss)
January 25, 2021, 9:15am
2
@aaydin
you can do a group by and split the groups into tables
assign activity
leftside: TableList (DataType: List(Of DataTable)
Right side:
(From d in YourDataTableVar.AsEnumerable
Group d by k=d(“Receiver”).toString.Trim into grp=Group
Select grp.CopyToDataTable).toList
in a second step us a for each (TypeArgument: DataTable) and iterate over the different group datatables e.g. for sending the different emails
Visuals:
Acces the group key (in your case the email id) with grp(0)(YourKeyColNameOrIndex).toString:
find starter help here:
SplitToTableList_1Col.xaml (7.2 KB)
2 Likes
First read the excel file and store in dt1
Then use assign activitiy as
dt2= dt1.DefaultView.ToTable(“Receiver”,True)
This will contains dt2 with only unique reciever names.
Us for each row to loop through each recover value in DT2
Inside it do the following:
Use filter datatable activity to filter Accordingly
Input Datatable: dt1
Output Datatable: dt3
Filter condition
Receiver= row(“Receiver”).ToString
Now the output of filter datatable activity is dt3.
Now after this use for each row to loop through dt3
Since u need to.embeded the each row data in body of email.
You can use HTML.part and embedded the required values.
And after doing that use send mail activitiy to send the mail ( after exiting from for each row of dt3)
Hope the above idea helps you
Regards
Nived N
Happy Automation
1 Like
aaydin
(Ahmet Aydin)
February 3, 2021, 7:06pm
4
Hi Nived,
thank you very much.
How can I embeded the table into the emails?
Do I need to create a data table and add the rows in this table?
aaydin
(Ahmet Aydin)
February 4, 2021, 1:16pm
6
Do I need to put the second “for each row”-loop into the first one?