Skip to main content

XLSX Renderer - Command Line Interface

NPMnpm

Github: https://github.com/Siemienik/XToolset/.../xlsx-renderer-cli

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.

Usages

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

package.json:

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

bash:

npm run generate-xlsx

Examples

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]

Arguments

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

Options

  • -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

Output

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

Support

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].