cancel
Showing results for 
Search instead for 
Did you mean: 

How to pick a specific excel file from a folder?

Lily.L
Level 5

Hi there,

I have a couple of downloaded Excel files, and I want to choose 1 file to move to another folder.

Here're the Excel files and the process map & Downloads folder

30748.png

30749.png

First, I use Get Files to get all Excel files and it working

30750.png

30751.png

and the collection output

30752.png

Now I want to Filter the latest Excel File. and choose the file xxx20.48.44 to work on. Can you please show me how I can do that? Note: the Excel file name is given by "excel-yy-mm-dd_time.xlsx", therefore, the Excel file name will be changed time by time. Is there any way I can achieve that? [I know the Filter Collection action with the "latest written" but it's not a good choice since I dont know how to do it and many files arrived at the same time, and I want to filter and pick the file by name. Thank you!



------------------------------
Mia Mikela
------------------------------
3 REPLIES 3

Hi @Mia Mikela

The most straight forward way to do this is simply loop the collection and use InStr to identify the correct file name which can look for a part of the name rather than the full name of the file. Create a loop through the files and use a decision stage to check the name using InStr, the query would read InStr([Files.Name],"13-01-2023")>0 if this is true then you use the action Move file if not then onto the next file name. If the file date is dynamic then you can use the date functions in place of a static value e.g. FormatDate(Today(),"dd.MM.yyyy") will give todays date.

30732.png



------------------------------
Michael ONeil
Technical Lead developer
NTTData
Europe/London
------------------------------

MichealCharron
Level 8

@Mia Mikela

The Date/Time format in the file names is perfect for alphanumeric sorting. You could simply use the "Sort Collection" action in BP's "Utility - Collection Manipulation" VBO to sort the file names in reverse order (the "Ascending Order" parameter set to "False"). This would push the latest file up to the top.



------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------

Micheal Charron
RBC
Toronto, Ontario
Canada

Thanks Oneil and Charron, it working now 🙂



------------------------------
Mia Mikela
------------------------------