Handling File Path Differences When Sharing UiPath Automations via Orchestrator

How does building and sharing automations on UiPath work, particularly when file paths differ between the builder and the recipient? For example, if a robot is developed in Studio and saved in a folder on the builder’s Desktop, and then shared via Orchestrator with another user, how will the recipient know which folder to run the robot from if it reads data from an Excel file? Will the recipient need to select a specific folder for the robot to operate correctly?

@Thobile_Bengane,

You can make the file paths dynamic using code like this:

strFilePath = "C:\Users\"+Environment.UserName+"\Desktop\Test Data.csv"

Thanks,
Ashok :slight_smile:

1 Like

hi @Thobile_Bengane ,

  • Using Relative Paths:
  • Instead of using absolute paths (e.g., C:\Users\Builder\Desktop\file.xlsx), use relative paths based on the project directory. This ensures the automation can find the files regardless of where the project is located on different machines.
  • For example, place the Excel file within the project folder and reference it like ".\file.xlsx".
  • Config Files and Arguments:
  • Store file paths in a configuration file (e.g., config.xlsx or a JSON file) and read from this file at runtime. This way, the paths can be easily updated without changing the main automation code.
  • Alternatively, use arguments to pass file paths to the workflow. When deploying the automation, these arguments can be set according to the recipient’s environment.
  • Environment Variables:
  • Utilize environment variables to construct file paths dynamically. For instance, you can get the path to the Desktop using Environment.GetFolderPath(Environment.SpecialFolder.Desktop).

Regards
Sandy

1 Like

Hi @Thobile_Bengane

To overcome the difficulties of specifying file paths in Studio workflows, we recommend using assets in Orchestrator. Here’s the process:

  1. Create an Asset in Orchestrator:

    • Create an asset and assign it the file path as its value.
  2. Retrieve the Asset in Studio:

    • Use the Get Asset activity in Studio, providing the asset name you created in Orchestrator.
    • Create an output variable to store the asset value, which in this case is the file path.
  3. Use the File Path in Your Workflow:

    • Utilize the stored file path variable for further processing in your workflow.
  4. Updating the File Path:

    • When publishing or executing the code on another machine, simply log in to Orchestrator, go to Assets, edit the asset, and update the file path.

This method ensures flexibility and ease of updating file paths without modifying the workflow code.

Hope it helps!!

1 Like

Don’t use hard-coded local paths when writing your automation. The file(s) the automation needs should be in a shared location (ie network folder).

Automations aren’t “run from a folder.”

1 Like

A source file should never be stored on nor processed from a user’s desktop. It should be in a shared location.

1 Like

This won’t work if more than one person runs the automation. The correct way is not to use hard-coded local paths in the first place, store source files in a shared location (ie network folder).

1 Like