Open file which starts with letters and ends with letters

Hey guys!

Currently I run a process where I open an excel file which lies in a folder. The folder keeps getting refreshed so that new excel files come in and have a similar name. For example the old file’s name is “UiPath_Monday.xlsx” and it will be moved to another folder. One day later a new one comes in and is called “UiPath_Tuesday.xlsx”. Now I need to know if it is possible to put in my excel application scope something like “UiPath_…xlsx” so that it opens the file which starts and ends with these letters even if it is the same folder. I hope you understand my concern and I’d be grateful if you can help me out.

Kind regards

Hi RandomGuy,

To do this you would use a wild card in your file name. In your case you would want to us “*” because the file name won’t always contain the same number of characters

@RandomGuy - Use FilesList=Directory.getfiles(FolderPath) …Then use the EachFile =FilesList in the for each…inside the for each use startprocess to pass the EachFile…

Hey @nlee ,
thanks for replying. How would it look like in the Excel Application Scope in order to open the file?

Hi @RandomGuy

Is the day is mentioned is the current day or some?

Hi @prasath17 ,
thanks for your answer.
Wouldn’t it take every file which is in the folder? I should have mentioned that the folder contains of several (excel) files and in this case it would take all of them I guess.
I hoped that something like this would work in the Excel Application Scope:

@NIVED_NAMBIAR
It’s just an example. The file gets put in the folder each month but the folder contains of several files, I forgot to mention that. See my reply above where I posted a screenshot of how I imagined it could look like :slight_smile: :blush:

Hi @RandomGuy

You can try this

  1. Filter the files present in folder based on filename containing “UiPath_”

  2. After the filter if there is files then loop through it

This is the logic u can try

For trying this logic u can do as below

  1. Use assign activitiy

list_1=Directory.GetFiles(folderpath).Where(Function (file) file.Contains(“Uipath_”)).ToArray

Then use if Condition with condition as list_1.Count<>0

If it true:
Then then use for each loop to loop through each element in list_1 array ( each element implies each filepath)

Inside the loop use excel application scope to open the excel file

Hope it helps

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed: