15

Is it possible to tell Excel to open a file from the command line?

In Linux, I could do this using the command

libreoffice --calc test.xlsx
24

You can use the open command:

This will use the default application for the file type, which may not be the desired application.

open test.xlsx

or, to specify the application explicitly:

open test.xlsx -a /Applications/Microsoft\ Office\ 2011/Microsoft\ Excel.app/

or even,

open test.xlsx -a "Microsoft Excel"

A really useful way of doing this is to make an alias to Excel (in your .bash_profile)

alias xl='open -a "Microsoft Excel"'

Then you can just type the following to open an file in Excel:

xl file.csv
3
  • Thanks. I didn't know that the open command exists, and that there are so many different ways to do it. – I Like to Code Apr 11 '14 at 23:58
  • 1
    The first example will open the file with its default application. On my system, that is LibreOffice. – WGroleau May 6 '20 at 4:10
  • Good point, @WGroleau. I'll adjust the text above... – Scot May 6 '20 at 4:11
0

To open the excel file from the directory, this is the command you should use

libreoffice --calc /Path/Of/The/Directory/Excel.xlsx

To open new excel file use

libreoffice --calc
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .