How to read previous week's date of an excel file

I am trying to open up an excel file every week from the previous week. So for today 07/06/2020, I need to open the excel file for 06/29/2020. The file path name reads like this “2020 06 29.xlsx”

I could use some help on how to set up variables to be able to read and open the excel from last week every week of the month.

You can open the file with a string variable set to String.Concat(Now.AddDays(-7).ToString("yyyy MM dd"), ".xlsx").

Hi @olsonse,

To get the previous week file from current day use the following

Now.AddDays(-7).ToString(“yyyy MM dd”) + “.xlsx”

in the Excel Scope or Workbook Read Range.

Warm Regards,
Ranjith Udayakumar

But I need to get the previous week file from my desktop. when using the following above, it creates a new excel file with that expression.

Hi @olsonse

Did you use it in Read Range?

File will be opened if it is available in the location.

“C:\Users\dines\Desktop\” + Now.AddDays(-7).ToString(“yyyy MM dd”) + “.xlsx”

1 Like

You’ll need the full path to the Desktop in front of that variable. It should be C:\Users\<your username>\Desktop\.

it is still not working right. It keeps pulling up a new file with that date expression.

You need to replace with the username you log into Windows with.

@olsonse We might need to see the Workflow design as to what you are currently doing. Can you show the Screenshots of how you are trying to read the Previous Week file?

I figured it out on my own thank you though

1 Like