Get file path from an excel sheet and use that in Send SMTP Mail Message activity to send attachments

I am fairly new to UiPath and I need help in sending mail message with 2 attachments. I have my client data in an excel sheet and I need to send them downloaded files to their mail ID. Both mail ID and file path is in an excel sheet, I am having trouble with sending attachments, since I don’t know how to mention the path in AttachmentCollection. Thanks in advance.

1 Like

Hello @Vijay_Manimaran ,

You can give the path like this in AttachmentsCollection property:

If more than one attachment is present, give path as comma-seperated values.



Hi Athira,

Thank for replying. The problem is the path we give in AttachmentCollection property is inside an excel sheet. Is there anyway I can get the path directly from excel sheet for each client and complete the Send SMTP Mail Message activity

Yes, you can. Can you please show me how attachment path is coming in the excel sheet?



Welcome to uipath forum

Hope the below steps would help you resolve this

  1. Search as workbook in activity panel in studio and under that choose read range activity and pass the filepath as excel as input and get the output as dt

  2. Now create a list variable in variable panel named list_filepath which is of type System.Collections.Generic.List(of String) with default value as New List(of String) defined in variable panel

  3. Then use a FOR EACH ROW activity and pass dt as input

  4. Inside that loop use a ASSIGN activity like this

If you have two columns mailid and filepaths

Where mail I’d has the mail to whom you want to send and filepaths has 2 filepath separated by ; semicolon

  1. So in that assign activity mention as

list_filepath = Split(CurrentRow(“filepaths”).ToString, “;”).ToList

And now use send outlook mail activity where in attachment collections mention as list_filepath and in mail id mention as CurrentRow(“mailid”).ToString

Cheers @Vijay_Manimaran

This is the excel file. Here I use the Username and Password from excel sheet to login and download files. Then I move the downloaded files to a particular Location for each client. From there I have to send those files to client’s email and Whatsapp accounts. But I don’t know how to mention the file location in AttachmentCollection property. Can you help me here?


Just assign the file location in a variable like CurrentRow(“Location”).toString. And in Attachment collection, pass the variable like this:
{ str_FilePath}

That’s it!


When I try this, error shows up like this.

Hi @Vijay_Manimaran ,

Looks like the Value you are passing is a Folder Path and not a File Path.

Firstly, If you want to Pass all the files Present in that Folder, then you would need to Get All the Files using Directory.GetFiles() method in the below way :

FilePaths = Directory.GetFiles(row(5).ToString)

change the variable name from FilePath to FilePaths, and the Type to Array of String

Pass the FilePaths variable directly in AttachmentCollection Property and Check, you would not need to use {}.

Also, the Error Points out that, you are unable to access. Is it the case manually as well ?Are you able to access that Folder manually from the same machine?

1 Like

Iam trying this now and to answer your last question, yes I can access the folder manually. It is just a sample folder created for test run.

Thank you. It works.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.