Send Email from Outlook With Attachment and Folder Location Based on Date


I’d like to attach a file to a sequence where the folder location and file name change based on the day. The goal is to grab yesterday’s file which is saved in yesterday’s folder. The file path will look like this:


I tried the below but get an error saying file path not found.


How can i get the robot to pick up the correct file?

Hi @jaroldizquierdo
welcome to forum

can u show how the file path looks like?

In file strcture can u show?

@NIVED_NAMBIAR are you asking for the file path or what i have written for the path?

Simplified actual file path (with some removed confidential information) is below

Here is what I have written:

Hi @jaroldizquierdo

Can use this path method


hi @jaroldizquierdo ,

Welcome to the community :slight_smile:

The error is occurring because you are trying to save the attachment into a folder which doesn’t exist.

To troubleshoot we will need to do path exist and then create path as per that…

Hope this helps :slight_smile:


Hi @NIVED_NAMBIAR - thanks for getting back but unfortunately it still isnt working. I even tried using the following to test it and I still got the error.


Hi @Shubham_Varshney - thank you for your response. Does attaching a file save the file? I am not trying to save - simply grab a pre-existing document and attach it to an email and send.

If creating a path exist will help, do you have a walkthrough of what that would look like?

Hi @jaroldizquierdo
i forget to add the .xlsx at end, kindly check my above response. I had edited the issue

Got it… Check first if the file exist. By doing so you will make sure that the file actually exist before going ahead with attaching it :slight_smile:


@NIVED_NAMBIAR this appears to be the same method I already tried and unfortunately it still did not work. Thank you for trying.

@Shubham_Varshney Thanks for the response - the file does exist however even when i try this simplified format it does not work

This was actually the solution. When you put the code the "\" did not go through, but it worked. Issues with my original code were capital YYYY for year and forgetting to put a "\" before the file name. Thank you!

1 Like

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