Find an excel file with wildcard name


I need to read an excel file monthly from a dynamic location. I have coded the location to be dynamic but I do not yet have a process to save the file in this location, it will be manually saved there in the location each month. Is there any activity that helps me find the file name with a key word and wildcard?

In future I will automate the sourcing and saving of the file, but for current version of automation I’d like to find the file name dynamically.

Hello Daniel,

If I understand correctly, the folder structure is static, it’s just that the file name could be something different? If that’s the case, I didn’t find anything that will do that automatically, I had to make something myself that would do Directory.GetFiles and then parse the output of that to only return the files that matched a specific regular expression. Unfortunately the GetFiles method uses its own quasi-regex format that I wouldn’t suggest even bothering with. Just be sure to remember that Windows files are not case sensitive when you search for specific filename conventions.

Thanks @dmccammond - file path is dynamic but I had no problem with that part. This was a really helpful solution, not sure how I missed the GetFiles Directory option, works great!

1 Like

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