Hello,
I am creating some .csv files of Persons name in Folder ‘Buyer’

e.g
Rahul Buyer.csv
Mehul Buyer.csv
Pooja Buyer.csv
.
.
.
etc
I have another file Buyers Email.xlsx

I want to send an Email to That Person’s Email ID associate with his name with his file names Attachment File
e.g
File Name : Mehul Buyer.csv
To : Mehul@gmail.com
Attachment : Mehul Buyer.csv
File Name : Rahul Buyer.csv
To : Rahul@gmail.com
Attachment : Rahul Buyer.csv
Any Idea or sample workflow would be appreciated.
Thanks
Too lazy to actually build the example, but this is your solution:
- read your excel with the adresses and store this in a datatable (DT_EmailAddress)
- loop through your input folder: for each ‘FileName’ in Directory.GetFiles(InputFolder)
- while in the loop: extract the name from the filename: split(FileName, " "c).First → Recipient
- do a lookupdatatable with your DT_EmailAddress, use the lookupvalue Recipient and return the email adress → RecipientEmail
- send a mail using the FileName as attachment, Subject, and the RecipientEmail as the ‘To:’
And you’re done.
1 Like
Thanks for the advice to a beginner in the Uipath.
One more question is I need to take some action if any File is present in the Folder and It’s email ID is not listed in the Email Excel File.
Thanks
That’s not a qestion 
But yes I suppose you need to build in your validations.
Based on your ‘remark’, I’d suggest that after extracting the name from the filename, and doing the lookup in excel, you validate if the email extraction yielded a result. So if RecipientEmail = “” then throw an error, or whichever your cleanup action is.
Folder Path : “C:\RPA\Dev\Test\Buyer Files”
using split(FileName, " "c).First
O/p is : C:\RPA\Dev
Need the names of the Files.
Thanks 
You read it wrongly…
directory.getfiles(“C:\RPA\Dev\Test\Buyer Files”)
this reads all the files into an array of string.
With the for each filename in this array gives your each individual filepath of all files in that directory.

Edit: small mistake in this screenshot: split().last should be split().first