Hi, I have this file I have to open but the location of this file is not static. Is there a way for me to find the location on UiPath just by name?
Hi @Eylul_C
Try this way
Assign (filePaths = Directory.GetFiles("C:\YourRootDirectory", "*YourFileName.xlsx*", SearchOption.AllDirectories).ToList())
If Activity
- Condition: filePaths.Count > 0
- Then:
- Assign (filePath = filePaths.First())
- Use filePath in further activities (e.g., Open Excel Application, Read Range)
- Else:
- Handle the case when the file is not found (e.g., Log message, throw exception)
Regards,
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.