Read Cell from Downloaded Attachments from Outlook

Hi everyone,

I am trying to download an xlsx attachment from incoming mail and save it to a dynamic folder. Until this part everything works well. However, when i want the robot to read cell from the downloaded cell it says the workbook does not exist.

Please see below the codesi use:

Step 1-

For Save Attachments Folder Path is as follows → “Attachments/” +emailMessages+“/”+formattedStamp.ToString(“dd-MM-yyyy_HH-mm-ss”)+“/”

Step 2- I assign “files” variable (list of strings)

“files” = Directory.GetFiles(“Attachments/” +emailMessages+“/”+formattedStamp.ToString(“dd-MM-yyyy_HH-mm-ss”)+“/”)

Step 3- for each file in “files”

Read Cell ->WorkBookPath → Directory.GetFiles(“Attachments/” +emailMessages+“/”+formattedStamp.ToString(“dd-MM-yyyy_HH-mm-ss”)+“/”)

Thank you in advance for your help on this.


This must be the issue
As the seconds and minutes might change while being in save attachment and while calling with GetFiles method
So let’s do one thing
Before using the folder and string concatenation in the save attachment assign this to a variable
Like this
In_folder = “Attachments/” +emailMessages+“/”+formattedStamp.ToString(“dd-MM-yyyy_HH-mm-ss”)+“/”

— now use this variable In_folder in the save attachment and in GetFiles as well like this
files = Dircetory.GetFiles(In_folder)

Simple isn’t it
Hope this would help you
Cheers @batuhan

Thank you @Palaniyappan, i tried but the issue still continues. I think the problem is related with the workbook path that i must write for read cell activity. Do you think “folder” variable here is correct?

1 Like

Hi @batuhan,
I think you have to keep file variable instead of folder for the path of the excel…

1 Like

Kindly mention file in the Read cell as a file path
As it is the variable that we get from for each loop as it holds the file path of the excel

NOTE: make sure that the type argument property of for each loop activity is String in the property panel
Hope this would help you
Cheers @batuhan

@Palaniyappan, @Vashisht thank you very much both! now it works! :slight_smile:

1 Like

Cheers @batuhan

Hi @batuhan,
Good to hear,Then mark it as solution and close the thread.
Any issue ping me.

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