FilePath

Hello everyone!
I have read some topics regarding the question I have, however it is not a 100% clear to me, since I am pretty new to UiPath.
So, I would like to ask you, guys, how do I assign a dynamic file path?
The robot opens an Excel file and takes some data from it, but the file should be able to be open from every computer.
I’d appreciate some help! :slight_smile:

HI @zhasmina.dimitrova

This will get the specific UserProfile dynamically

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads" 

Environment.ExpandEnvironmentVariables("%USERPROFILE%\Downloads")

image

Regards
Gokul

1 Like

HI @zhasmina.dimitrova

Updated the expression to get the excel files also inside the folder

Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads\","*.xlsx")

Regards
Gokul

2 Likes

HI @zhasmina.dimitrova

If your files will be inside your project folder you can use

Environment.CurrentDirectory+"\Folder name or Filename.xlsx"

Regards
Sudharsan

1 Like

Thank you all for the help!
I will try to do it both ways!

This will get all the files inside the folder contains XLSX and also every computer. Let us know, if do you face any issue.

Regards
Gokul

Thank you, but an error occurs, I can’t understand exactly why - "Value of type 1-dimensional array of string cannot be converted to string.

Hi @zhasmina.dimitrova

The Variable Type Should be Array(String)

image

image

Regards
Gokul

1 Like

Thank you very much, it worked!

1 Like

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