Open file in folder if title contains certain text


#1

Hi,

I am looking for a way to perform actions on all excel files in a folder for which the filename contains the text “v1”.

Anyone to share ideas?

Thanks!


#2

@yannip

You can use Directory.GetFiles(FolderName, Pattern) to find the files in that folder that follow the given pattern.
Please check this sample to find .xlsx files containing “v1” in the name: GetFilesWithFilter.zip (2.0 KB)


#3

Hi @Mateus_Cruz,

Thanks a lot for the valuable input.
Looks great, but now I need to add an application scope for excel if I want to read cells/ranges.
The problem is that I then need to define a path to the excel file. I cannot do that as I want it for all the files.
How should I approach this?

Thanks!


#4

Directory.GetFiles(FolderName, Pattern) will return file paths as strings, so you can just use that as input for the Excel Application Scope activity.