Ubuntu – How to print sheetnames of a spreadsheet using Linux command-line

command linecsvxls

I am aware of using in2csv to save a particular worksheet as a .csv:

in2csv --sheet "sheet name" file1.xls > sheet-name.csv

But are there any other tools to just print the sheetnames?

Perhaps there are options with Perl?

Best Answer

in2csv from the csvkit package provides the --names or -n option for that: [Source]

 -n, --names     Display sheet names from the input Excel file.

In your example the command would be:

in2csv -n file1.xls

This feature was added in csvkit 1.0.2, which is not available from the official package sources for releases older than Bionic. If you’re running Xenial you need to either

  • compile the program from source or
  • install it via pip with

    sudo pip install csvkit
    

to get the latest version.