Trouble passing variable as path in Excel activity

I am using an excel activity scope to use the file.

I have an excel file here: D:\systems\excelFiles\fileName.xlsx
The project I am working on is here: C:\Users\Me\Documents\UiPath\project\

My excel file name and location will be different each time, so I am passing the path using a variable: thisFile

When I try to use the excel file, I am getting the following exception:

Use Excel File: Excel File C:\Users\Me\Documents\UiPath\project\D:\systems\excelFiles\fileName.xlsx was not found.

I checked the local variable in debugging and the path I am passing to the activity is D:\systems\excelFiles\fileName.xlsx

I cannot figure out what is causing this.

@conner.caspar

Welcome to the community

  1. Please check fi there is any space at the start of the string…
  2. also try checking if there are inverted comma given extra…
  3. Just remove the activity and re add and check

Hope this helps

cheers

Hi @conner.caspar

To resolve this issue, you should ensure that you provide the full and correct file path when working with Excel files.

Here’s how you can correct this issue:

  1. Ensure Variable Contains a Full File Path:

    Double-check that the thisFile variable indeed contains the full and correct file path, including the drive letter (e.g., “D:\systems\excelFiles\fileName.xlsx”).

  2. Use the Variable Directly:

    When using the Excel activities, pass the thisFile variable directly as the Excel file path without attempting to combine it with any project folder paths.

    For example, in the “Excel Application Scope” activity, set the “WorkbookPath” property to thisFile.

  3. Avoid Concatenating Paths Manually:

    Ensure that you’re not manually concatenating paths in your workflow using string operations like “+” or "". It’s best to use variables that hold the full path to avoid path-related issues.

  4. Verify File Existence:

    Before using the Excel file, you may also want to add a check to ensure that the file actually exists at the provided path. You can use the “File Exists” activity for this purpose.

Show us your Use Excel File activity. Obviously something is wrong with how you’re passing the path.

I was not able to fix the problem with the excel activity, but I was able to save the file to a static folder, and then use the move file activity to move it to the path variable.