How to open Excel file when the file path is a variable

Hi,
I recently received help setting up a file path as a variable string, see attached topic, but now I am having trouble accessing the file as the process begins.

https://forum.uipath.com/t/how-to-open-a-file-folder-of-current-year-and-then-look-for-another-folder-with-specific-date/70206?u=melaniewatson

I am using an Excel Application Scope to open an Excel file and while in the development phase, I had been using straight forward workbook path, for example: “H:\common\TRANSPORTATION\PROD Route Optimization\2018\10.29.2018\10.29.2018 Routing Guide RPA”. To the start the process, the excel application will open the file, then click on a specific tab labeled “Supplier.” From there the workflow will move back and forth from the Excel file to a Host Mainframe System. The data will be copied from the excel sheet then pasted into the mainframe system, updating specific parameters as defined in the Excel file. I have all of that set up, tested and ready to deploy, but I am needing to figure out how to enter the file path variable in the Excel application scope so that the file can be accessed.

Thank you as always for your help!

1 Like

Hello @melaniewatson

Could you share your flow to check it?

Hello,

Please use below xaml file to open up excel file with path variable,
Here I’m reading path from configuration file and storing into a variable. I’m supplying that variable to workbook path property.of excel application scope.

Config.xml (126 Bytes)
OpenExcelWithVariable.xaml (9.0 KB)

Cheers,
Pankaj

Hey @melaniewatson

The variable itself is the whole path. just paste it in the read range/excel scope

image or

image

Once you have the excel path you dont need to open it and click on the tab and use the data back and forth during the process.
What you will do is use a Read Range activity to read that particular sheet data.
Use the workbook one:

image

After that you will have a data table variable which you will loop through using a For Each Row
Inside the for each you will be doing the paste into the mainframe system and updated.
It will do it for all your entries

@Pankaj.Patil - I am not sure that your example will work in my situation. I am attaching my flow to @dkollyns reply.

image
Remove “.xlsx” from variable path using assign activity. path=path.Strip(“.”)(0) insert assign activity before excel application scope