June 23, 2022, 9:39am
I would like to ask how can I send emails to multiple users by reading the file name of an excel file and match its respective emails in a column?
By reading the file name, I can match its Name to its respective email in column C and send it via outlook.
Eren.xlsx (8.3 KB)
Rohan.xlsx (8.3 KB)
Thomas.xlsx (8.3 KB)
File name Eren, Rohan and Thomas can match the emails in column C in name + details excel file.
Name + Email Details.xlsx (9.5 KB)
Read the excel using read range output as ->Dt_Out
Take one for each roe in DataTable pass the Dt_oUT
Take one assign activity create one variable called Mail pass the value like this
Take one Send SMTP Mail Message or Send Outlook Mail Message activity-> Fill the necessary details
in the to field pass the Mail variable which we created earlier
June 23, 2022, 9:48am
I am assuming your files will be in a folder and you have read the Name +Email excel to a Datatable named (v_InputDataTable), please follow below steps
Read the files from the folder using Directory.GetFiles(“FolderName”,“*.xlsx”) which will give an output as Array variable
Use Foreach Loop and give the array variable as input for the loop, and inside loop have a Assign activity as below:
String FileName = new System.IO.FileInfo("your file path ").Name FileName variable will give the name of the file which you can use it in the select query
In another assign use as below to filter:
string Email_ID = v_InputDataTable.AsEnumerable.Where(Function (x) x(“Name”).Tostring = FileName).ToList(0).Item(“Email”).Tostring
You can use the below steps:
Read range activity : read the excelsheet to get the datatable(dt)
assign activity : listEmail = dt.AsEnumerable.Select(Function (row) row.Field(Of String)(“Email”)).tolist
Assign activity : emails = String.Join(“;”,listEmails.ToArray))
Send outlook mail : To = emails
June 28, 2022, 9:42am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.