Get File according to date (FileName includes it)

Hello

before starting the Bot i have to make sure it opens the right file. So my problem is, that everytime i see a solution here on the forum, it only gets with assign activites, but i need the right workbook path at the beginning of the excel application scope. With that, i have to make sure to open only 1 file.

For example: today´s file is : “Prio Compare_summary_1007” and i need to open the file from last week so it would have to be “Prio Compare_summary_0307”. As you can see the last numbers are in the following format: “ddmm”, so first the day and then the month.
image

i hope you can somehow realize that into UiPath.

Kind regards!

You already know the format right? You can calculate the date dynamically and form the file name.

You can get Friday of the current week by using the code below

var today = DateTime.Today;
var friday = today.AddDays(-(int)today.DayOfWeek).AddDays(5);

Hi @mcLauge

So opening of the file as per the date ending in the filename.
In this the date will be taken as a input from user or der are some rules that should follow the sequence of reading the file as per date ??

Can you give the details for the same

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

thanks for the reply @Pratik_Wavhal
no there is no input from the user, the Bot should automatically select the file from last week (exact 7 days before).

Kind regards!

@mcLauge use the following expression in the excel application scope path :
“Prio Compare_summary_”+Date.UtcNow.AddDays(-7).ToString(“ddMM”)+“.xlsx”
image Sequence8.xaml (3.9 KB)

Hi @mcLauge

So you can do the following thing

This will give you date of 7 days before depending on the todays date.

Below is the Workflow for the same :-
Main.xaml (8.4 KB)

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

2 Likes

thank you very much, it works now!

1 Like

i tried the solution above, but i am very thankful for your help!

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