18

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

2 Answers2

26

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
Scot
  • 8,045
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
tubedogg
  • 15,240