Skip to main content

Spreadsheet Tools with Nexe

nexe1 is a tool for generating command-line tools that embed scripts.

SheetJS is a JavaScript library for reading and writing data from spreadsheets.

This demo uses nexe and SheetJS to create a standalone CLI tool for parsing spreadsheets and converting to other formats.

The latest prebuilt package matches NodeJS version 14.15.3.

nexe can build the required packages for newer NodeJS versions.

Tested Deployments

This demo was tested in the following deployments:

ArchitectureVersionNodeJSSourceDate
darwin-x644.0.0-rc.614.15.3Pre-built2024-05-28
darwin-arm4.0.0-rc.618.20.3Compiled2024-05-25
win10-x644.0.0-rc.414.15.3Pre-built2024-04-18
win11-arm4.0.0-rc.620.10.0Compiled2024-05-28
linux-x644.0.0-rc.414.15.3Pre-built2024-03-21
linux-arm4.0.0-rc.618.20.3Compiled2024-05-26

Integration Details

The SheetJS NodeJS module can be required from scripts. nexe will automatically handle packaging.

Script Requirements

Scripts that exclusively use SheetJS libraries and NodeJS built-in modules can be bundled using nexe.

The demo script xlsx-cli.js runs in NodeJS. It is a simple command-line tool for reading and writing spreadsheets.

Complete Example

  1. Download the test file https://docs.sheetjs.com/pres.numbers:
curl -o pres.numbers https://docs.sheetjs.com/pres.numbers
  1. Download xlsx-cli.js
curl -o xlsx-cli.js https://docs.sheetjs.com/cli/xlsx-cli.js
  1. Install the dependencies:
yarn add https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz exit-on-epipe commander@2
  1. Create the standalone program:
npx nexe -t 14.15.3 xlsx-cli.js
Building from source (click to hide)

When the demo was tested on ARM targets, the Nexe pre-built packages were missing. For unsupported NodeJS versions, packages must be built from source:

npx nexe xlsx-cli.js --build --python=$(which python3) --make="-j8"

This generates xlsx-cli or xlsx-cli.exe depending on platform.

  1. Run the generated program, passing pres.numbers as the argument:
./xlsx-cli pres.numbers

Footnotes

  1. The project does not have a website. The source repository is publicly available.