XLSX Quickstart
This is the fastest path to first value with CmdCal XLSX:
- install
@paperjsx/json-to-xlsx - describe your workbook as structured JSON
- render a real
.xlsx - open it in Excel, Numbers, Sheets, or LibreOffice
Install
Terminal
pnpm add @paperjsx/json-to-xlsx
First Render
TYPESCRIPT
import fs from "node:fs/promises";
import { SpreadsheetEngine } from "@paperjsx/json-to-xlsx";
const workbook = {
meta: {
title: "Quarterly Revenue",
creator: "CmdCal",
},
sheets: [
{
name: "Revenue",
rows: [
{
cells: [
{ value: "Quarter" },
{ value: "Revenue" },
{ value: "Closed" },
{ value: "As Of" },
],
},
{
cells: [
{ value: "Q1 2026" },
{ value: 420000 },
{ value: true },
{ value: new Date("2026-03-31T00:00:00.000Z") },
],
},
{
cells: [
{ value: "Q2 2026" },
{ value: 510000 },
{ value: false },
{ value: new Date("2026-06-30T00:00:00.000Z") },
],
},
],
},
],
};
const buffer = await SpreadsheetEngine.render(workbook);
await fs.writeFile("revenue-report.xlsx", buffer);
That gives you:
- a real OOXML workbook, not CSV-with-styles
- native worksheet structure
- typed values for strings, numbers, booleans, and dates
- deterministic output by default
Download The Same Example
- JSON workbook spec: quickstart-revenue.json
- Rendered workbook: quickstart-revenue.xlsx
Validate Before Rendering
If you want schema validation before hitting the render path:
TYPESCRIPT
import { SpreadsheetEngine } from "@paperjsx/json-to-xlsx";
const validated = SpreadsheetEngine.validateDocument(workbook);
const buffer = await SpreadsheetEngine.renderValidated(validated);
Add Styles, Filters, and Tables
Once the first render works, the next common step is adding the features users expect from a real export.
TYPESCRIPT
const workbook = {
sheets: [
{
name: "Revenue",
autoFilter: true,
rows: [
{
cells: [
{ value: "Quarter", style: { font: { bold: true } } },
{ value: "Revenue", style: { font: { bold: true } } },
{ value: "Margin", style: { font: { bold: true } } },
],
},
{
cells: [
{ value: "Q1" },
{ value: 420000, style: { numberFormat: "$#,##0" } },
{ value: 0.24, style: "percentage" },
],
},
],
tables: [
{ name: "RevenueTable", ref: "A1:C2" },
],
},
],
};
What To Learn Next
- Need operational trust: see Validation & Repair
- Working from customer templates: see Templates & Large Workbooks
- Building agent workflows: see MCP & Agents
- Want more runnable files: see Examples & Downloads
Good Fit
CmdCal XLSX is a strong fit when:
- your export logic is currently brittle and imperative
- you need formatting, tables, validations, templates, or print setup
- you want agent-friendly structured JSON in and real Excel out
- you need generation plus validation and repair, not just file creation
Current Limits
- true streaming write is still an active roadmap item
- cross-app desktop validation still depends on external target apps
- some broader repair rules remain intentionally conservative
That is deliberate: the engine prefers explicit validation errors and conservative repair logs over silent mutation.