Open Excel from Variable


What am I doing wrong?
I followed the same idea, but I can not make it work.2


I think it is because of the quotes around the paths to the file. Try removing them. Let me know if it doesn’t help.


That really was it. Thank you very much



I face a similar issue when opening the excel from a variable. When launching excel using launch window option and using the variable along i.e., launch application ${excelpath}${variablename} an error occurs where the path to excel is not displayed correctly.

Path to excel:

D:\RPAFiles\TempShare\ec\R-0721262\RPATemp\mx1545969372612\R-0711544_ACVCP00_DCR ECO 35278553 - 30APR2018\R-0711544_ACVCP00_DCR ECO 35278553 - 30APR2018.xlsx

Error images:

22 26 24 23 25
I have tried giving wait but it does not work… Kindly share what went wrong!!


Try using double slashes as explained here:

If you intend to publish your recording in Control Tower as a Bot Task, escape each slash character before publishing. It is done to avoid problems when the path contains the Space characters.


WorkFusion Studio:

C:\Program Files (x86)\Microsoft Office\root\Office16\excel.exe

Control Tower:

C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\excel.exe


I tried using space between the excel location and filename as suggested in but still not able to open the files using lunch window action. I get the filename using recorder variable and kindly suggest me how to change the slashes into double slash in the variable. Thanks in advance.



I’m able to open the excel. The problem was the filename had spaces in between them and once i removed the space i can open it. I removed the space manually and performed the operations but how to remove the space in filename using bot. Kindly suggest me the possible way to do it.


Hi @Arthi
to remove the spaces from the filenames automatically you can use the replace text action. In the field “text to find” put a space and in the field “replace with” dont put anything. Mark the checkbox “replace all”. This will delete all spaces


Thank you for the help!!


Hi all,

Is there a way to rename the file (i.e., to remove the space from filename inside a particular folder) using bot? Because when i open the excel using variable the path to excel is split where the path has space.

For Example,
D:\RPAFiles\TempShare\ec\R-0723368\RPATemp\mx1547113830270\DCR\R-0723368_DCR 09Jul2018.xlsx

while opening the above excel the bot displays error message as


where the path to file is split at the Space in the filename. But when i copy the path from clipboard i’m able to open the file manually. Is it the problem with the space or should i rename the filename. If so, what are the options available to rename as files and folders option does not have any methods for file renaming.


try this:

  • put the complete filepath and filename into a variable
  • put the variable into the clipboard
  • use Windows-R keystroke
    -CTRL-V keystroke
    and the file should open


Thank you for the help :+1:Yes i tried using the above action and the file opened. Since, this excel was opened manually( using keystroke action) i could not use excel functions( set cell, get range) under this. Is this problem with the space in the filename??


If you use open excel action and use the variable with the complete filepath and file name to your Excel it should work as well. I dont think it matters if there are any spaces in the path or name. Does it not work?


Yes when using file path and name to the excel can open from spreadsheet action and I wanted to open spreadsheet for finding the location of particular text in the sheet ( How to find excel coordinates? ) and since I cant drag-drop the custom script action under open spreadsheet action I’m finding it difficult to get the cell value. Kindly share any suggestions if the same operation can be done in some other ways…


Yes, there seems to be a bug that you cannot open a file via launch application if there are spaces in the filename. But when you do it via win-r it works. You cannot use custom actions within open spreadsheet action so to achieve what you need you should:
Open file via with win-r and then use the custom action as suggested in How to find excel coordinates?


Thank you for the reply but i m not able to fetch the cell value of the coordinate as suggested when i open the excel with the win - R method the file opens but the custom script action is not executed. Do i have to switch the window or something i have attached the snapshot for reference. The script step is skipped and i dont understand why…


Yes, you should switch to the window, from which you need to get the coordinates.


Thank you for the reply but how to switch the window as i can’t drop window actions inside the if condition


You can




Yes, there is a problem with opening Excel files that have a space in the name. But we cannot fix it as it is an Excel issue (it fails if you try to open it manually though Win+R, too).


So you need to either rename excel files that you need to open in Launch Application, or open them using Win+R using only the filename, without the application name.