Excel file folder path using variable for excel name

Hello Friends,

I am using variable to store the excel name and then using it in folder path. e.g. Excelname is variable which stores the name of the excel and C:\Users\Desktop\automation is a folder.
then for accessing this excel I am giving path as “C:\Users\Desktop\automation"+Excelname+”.xlsx" in excel application scope, however the program giving error: path ‘C:\Users\Desktop\automation.xlsx’ does not exist. here it is missing the Excelname in path. any reason why this so?!


Kindly check the Excelname holds value or not.
And Add \ in the folder path if you not added in ExcelName.

Suresh J


Since “C:\Users\Desktop\automation” is folder path

Please try like below.


If your error is showing this, then the value in the excelName variable is there, but check if there are any spaces in the file name @Rita_Balmukund_Jaisw

One more thing is, why don’t you check it before giving the path to excel?

I mean use Path exists activity and check if the path exists or not. if exists then provide the same path to the excel application scope

Hello @Rita_Balmukund_Jaisw

By the look of it… you have a missing ""

and this is the output
after automation you should introduce a "" additionally in the path, I don’t think ExcelName has a value because it’s not shown in the error message. it shows automation.xlsx which is actually the folder name

1 Like

Actually there are spaces in the variable Excelname, would this be causing an error? do i need to remove these spaces?

But when I use the message box to display the Excelname variable, it does show name of the excel, so in that case variable does hold certain value here, right?

Can you add the full combination of strings in the message box and see what it returns


1 Like


Use Message box before excel Scope and check Excelname hold value.
This may be due to Scope of the variable.

Suresh J

Yes, @Rita_Balmukund_Jaisw

It won’t recognize the folder of file if we have any additional spaces in the path

or if the excel name has spaces and if we are missing it in the studio, then also it won’t recognize. so everything should be as it is in the folder

So message box for variable show value of excelname. But when I try to display whole string in message box it missing variable name in again as you can see in images

I removed the spaces and mentioned everything as in the folder. still its giving me the same error

Are these message boxes coming from the same place? one after the other? or from different places?

I wonder whether the scope of the variable is the cause. Can you try changing the scope to the highest scope (the one at the very below of the scope list) and see whether it works


Kindly check the scope of the Variable.

Suresh J

Please copy both the names manually to the notepad and the path you are getting from the studio, then compare @Rita_Balmukund_Jaisw . I hope you are missing something.

please check manually copying both the names once

Every variable is for flowchart, highest level, message box coming from same place

Can you show a screenshot of the workflow, where you have the message box, and also the scope of the variable?

Here Path1: ‘Excelname’ variable
Pastefile: Excel file path with variable in it which is “C:\Users\some_folder_names\Automation"+Path1+”.xlsx"