Skip to main content

XLSX Renderer - Command Line Interface



Command line interface for xlsx-renderer. Generates spreadsheet files based on the template with view model.

Part of XToolset - collection of tools makes handling spreadsheet handy, easy with great developer experience.


Global installation

# Install globally:

npm i -g sxr

# Usages:

sxr --model vm.json --output output.xlsx template.xlsx

Local installation

1. Install package

# install globally:
npm i --save sxr

# usages:
node_modules/.bin/sxr --model vm.json --output output.xlsx template.xlsx

# usages with npx
npx sxr --model vm.json --output output.xlsx template.xlsx

2. Additionally, possible to use with packages.json scripts


"scripts": {
"generate-xlsx":"sxr --model vm.json --output output.xlsx template.xlsx"


npm run generate-xlsx


cat vm.json | sxr  --output output.xlsx template.xlsx

sxr --output output.xlsx template.xlsx "{\"jsonData\":true}"

sxr --model vm.json --output output.xlsx template.xlsx

sxr --model vm.json -o output.xlsx template.xlsx

sxr -o output.xlsx template.xlsx "{\"jsonData\":true}"

Command body

sxr [options] <template> [model]


  • <template> indicate the template file,
  • [model] view model as a json used to generate a spreadsheet,


  • -o --output <filename> write to filename
  • -m --model <filename> read filename as a [model] (using both is denied)
  • -o --output <filename> write result into filename


sxr out-of-a-box pushes generated files into stdout, to save it into a file please to append > filename.xlsx.

Library allowing also save output into file by using option -o --output <filename>

The template file

The template structure inherit from xlsx-renderer. Please use link below for more information:

XLSX Renderer Documentation


If any help needed, just feel free to create an issue. We will be really thankful for added links into stackoverflow topics if exists.

We are ready to provide paid support, in order that please contact me: [email protected] or [email protected].