≡ Menu

Run command for Excel

We can open Excel application from Run by executing the command ‘excel
Run command for excel and excel command line options
However, ‘excel’ command does not work from command prompt. We need to use start to open excel application from command line.

start excel

To open a specific excel sheet from Run window you can use the below command.

excel fileName

Example: Open the data.xlsx file located in ‘Documents’ folder

excel c:\Users\loginid\Documents\data.xlsx

If the file has whitespace in the name, then we can use double quotes as below.

excel "C:\Users\loginid\Documents\File with spaces.xlsx"

Other command line options for Excel application

Command for opening an excel sheet in read-only mode

excel /r fileName

Command for launching excel without opening a new blank document.

excel /e

Change the ‘Save as’ folder foe excel files:

We can set a directory as the default location for saving excel files. Command for this is:

excel /p  directory

For example to set D:\docs as the ‘save as‘ directory, the command is:

excel /p  D:\docs

Launch excel in safe mode

excel /s

or

excel /safemode

All the above commands can be executed from command line by adding ‘start ‘ in the beginning of the command.

12 comments… add one
  • Pavan

    Why executing ‘excel’ from cmd does not work though it works from Run? I get the error ”excel’ is not recognized as an internal or external command,operable program or batch file’.

  • Martin

    You must use excel.exe and not only excel

    • admin

      Even excel.exe generates the same error. Only Start excel works from cmd.

  • johnny

    admin is correct only start excel from cmd works

  • Ashraz

    to find installed Excel version?

  • Ravindra

    How to save as excel file in html format with same name in same location
    and also how to handle if override dialog comes?

    Provide me command which can run in command prompt

  • DJ

    How to open already created Excel file and Save it through Command window

  • Young

    admin is correct

  • ashley

    is there any command exist that can delete a (or a range of) cell?

  • Ishkatan

    Is there a way to pass commands from the command line to Excel once it has started? I want to import a .csv file and save it as an .xlsx file all from the command line. I am using Excel to get rid of “junk” characters in the .csv file. I can read the .xlsx in my program better. I would like to read the .csv into Excel, save as .xlsx and then exit all from the command line. I cannot put Macros into the file I am reading.
    FYI – You can run Excel from the cmd file if you give it a full path or cd to that directory.
    “C:\Program Files (x86)\Microsoft Office\root\Office16\excel.exe”

  • maaya

    How can i run an excel macro from command line !!

  • Herrick Andrews

    Add the path to excel.exe to your PATH environment variable.

Leave a Comment