December 20, 2021, 2:40pm
i have to make a process which send mail based on file name and name in excel. I get the file name then from datatable which has the company name and emails to which I have to send an email with attachement (the file in folder). In folder there are also files for other companies that I have to send so I need to compare file name and the name in excel and then send file to their mail (written and read from data excel table).
data.xlsx (10.6 KB)
Please follow the below steps and let us know if you face any issues.
Use work book read range activity and store your data.xlsx into EmailsDetailsDT.
Use For each and assign the Data table EmailsDetailsDT for loop the Names and email id one by one.
Store some variables for further usage like below for each iteration.
Name = CurrentRow(“NAME”).tostring
Email1 = CurrentRow(“EMAIL”).tostring
Email2 = CurrentRow(“EMAIL2”).tostring
Now the inside the for each row loop along with the above variables we have to maintain the below logic to get the exact file path by suing NAME variable.
use Assign activity → create string array
Filearr = Directory.GetFiles(“YourFolderPath”,“*”+NAME+“.xlsx”)
Use one more assign to get the Attachment file path as below.
AttachmentFilePath = Filearr(0).tostring
Now use the send outlook mail message activity and assign the values for the below properties.
To → Email
if you want bot the email id in the to iteself
To-> Email +“;”+Email2
Click attach files link in the send out look email messages activity and assign the attachment file path like below.
The for each row loop make sure that this process will complete for all the NAME in the xls. thanks
December 23, 2021, 6:40pm
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.