Excel Application Scope with dynamically changing file name

I have the following Excel Application Scope as part of a workflow. However, each day, the file name will change.

I.e. from U8319716_20190308_20190308.xls to U8319716_20190309_20190309.xls

image

I tried using wildcards (*) and also tried setting up the file name as a variable with wildcards, but that didn’t work.

Any suggestions?
Thanks.

@Gavin_Mcmaster,
Instead of hard coding the name you can create dynamic also like below.
Give your file path like
“C:/users/admin/u8319716_ “+now.tostring(“yyyyMMdd”)+”_”+now.tostring(“yyyyMMdd”)+“.xls”

@Gavin_Mcmaster

Using wildcards wont be a reliable one, in your case U8319716 this part of file name may also change.

So maintain a separate folder especially for these files, then get all the files inside the folder using the below vb.net expresion.

arrayOfFilePath = Directory.GetFiles("folder path","*.xls")

This expression will return array of file path which will be string, this function will only get all the .xls files from the folder.

This array you can pass to for each and read one by one. Now there won’t be any issues when file name changes.

Further you can refine the function using something like this,

arrayOfFilePath = Directory.GetFiles("folder path","U8319716*_*.xls")
2 Likes

Hello @Ragu9060, I meet the same problem, but I’m just start leaning Uipath,
can’t understand where to write the code you send,could you pls share me a snapture?
Thank you in advance!