sheetjs/packages/xlsx-cli
SheetJS 432ac1fda7 xlsx-cli v1.1.4 2023-10-11 16:22:42 -04:00
..
bin xlsx-cli v1.1.2 [ci skip] 2022-03-03 14:11:20 -05:00
.npmignore xlsx-cli separate package [ci skip] 2021-11-06 20:34:44 -04:00
LICENSE xlsx-cli v1.1.2 [ci skip] 2022-03-03 14:11:20 -05:00
README.md xlsx-cli v1.1.4 2023-10-11 16:22:42 -04:00
index.js xlsx-cli support dateFormat option (#3005) 2023-10-10 06:50:32 +00:00
package.json xlsx-cli v1.1.4 2023-10-11 16:22:42 -04:00

xlsx-cli

This is a standalone version of the CLI tool for SheetJS.

The main distribution point is https://cdn.sheetjs.com/xlsx-cli/

Modern NodeJS

For newer versions of NodeJS, the tool should be invoked with npx:

$ npx -p https://cdn.sheetjs.com/xlsx-cli/xlsx-cli-1.1.4.tgz xlsx-cli --help          # help and usage info
$ npx -p https://cdn.sheetjs.com/xlsx-cli/xlsx-cli-1.1.4.tgz xlsx-cli test.xlsx       # print first worksheet in CSV format
$ npx -p https://cdn.sheetjs.com/xlsx-cli/xlsx-cli-1.1.4.tgz xlsx-cli --xlsx test.csv # generates test.csv.xlsx from test.csv

No install step is required. npx will ask to install the module on first run.

Legacy NodeJS

For older versions of NodeJS, the tool should be installed globally:

$ npm install -g https://cdn.sheetjs.com/xlsx-cli/xlsx-cli-1.1.4.tgz                  # install globally (once)

If the global node_modules directory is owned by an administrator account, the install should be run as the root user or administrator:

$ sudo npm install -g https://cdn.sheetjs.com/xlsx-cli/xlsx-cli-1.1.4.tgz             # install globally (once, if root permissions are required)

The module will configure the xlsx-cli command.

$ xlsx-cli --help                                                                     # help and usage info
$ npx xlsx-cli --xlsx test.csv                                                        # generates test.csv.xlsx from test.csv

Usage

xlsx-cli --help displays full usage information.

By default, xlsx-cli path/to/file will parse the file and print CSV rows from the first worksheet in the file.

xlsx-cli path/to/file ws_name will use the second argument to determine the worksheet from which rows are generated

xlsx-cli path/to/file --xlsx will generate a XLSX workbook and save it to a file whose name is determined by appending .xlsx to the name. For example, xlsx-cli input.xlsb --xlsx will save the generated file to input.xlsb.xlsx