Blog

Export to SPSS (.sav)

The new SPSS extension turns any Jspreadsheet worksheet into a native SPSS .sav file that opens directly in SPSS, PSPP, and any tool that reads the PSPP System File Format — with column types, formats, value labels and measure levels translated automatically.

icon jspreadsheet

Published at 23/04/2026

Introducing

@jspreadsheet/spss is a Jspreadsheet extension that writes SPSS system files (.sav) straight from the browser or from Node.js. It takes the column configuration you already have — dropdowns, calendars, numbers, percentages, checkboxes — and produces a fully-typed SPSS dataset with value labels, variable labels, display widths, alignment and measure levels set correctly.

No external dependencies, no server round-trip: the extension outputs a pure binary Uint8Array, ready to download or persist to disk.

Export to SPSS

What's new?

A brand new extension, a single line to register, and two helpers attached to every worksheet.

downloadSav and generateSav

Once the extension is registered, every worksheet gains two helpers — downloadSav to trigger a browser download and generateSav to get back the raw binary.

jspreadsheet.setExtensions({ spss });

// In the browser — download directly
worksheet.downloadSav({ filename: 'survey.sav' });

// In Node.js or a Worker — get the bytes
const binary = worksheet.generateSav({ fileLabel: 'Survey' });

Automatic type mapping

Column types are translated to the right SPSS variable without extra configuration:

  • number, numeric, percent, autonumber → numeric variables with width/decimals inferred from the column format.
  • calendar → SPSS date value (seconds since 1582-10-14), written as DATE11 or DATETIME22 depending on whether the format carries a time component.
  • dropdown / autocomplete with { id, name } numeric sources → nominal numeric variables with value labels wired up automatically.
  • checkbox / radio → numeric 0/1 with No / Yes value labels.
  • text, html, email, url, tags, color, image, notes → string variables sized to fit the longest cell, using continuation records for long strings.
  • rating, progressbar → ordinal numeric variables.

Headers become the long variable name; a sanitized, uppercase 8-character short name is generated to respect SPSS's strict naming rules.

Value labels, variable labels and comments

The extension emits the full SPSS dictionary — not just raw values:

  • Dropdown sources are written as proper SPSS value labels, so the label text appears in SPSS / PSPP instead of the raw id.
  • Column headers become variable labels on the long name.
  • Worksheet comments are preserved in the document record, keyed by cell reference.
  • Display width, alignment and measure level (Nominal / Ordinal / Scale) are set from the column type.

Works in the browser and on Node.js

The output is a pure Uint8Array, so the same call works anywhere:

  • BrowserdownloadSav builds a Blob and triggers a download, no extra libraries needed.
  • Node.jsgenerateSav returns the bytes directly, ready to pass to fs.writeFile in a backend export pipeline.
  • Raw datasetsspss.generate(data, { headers, columns }) accepts a plain data[][] array, so you can produce .sav files without instantiating a spreadsheet at all.

Standards-compliant output

Files follow the PSPP System File Format spec:

  • Encoding: UTF-8 (character code 65001)
  • Compression: bytecode compression (opcode blocks with bias 100)
  • Dictionary: variable records, value label records, document record, long variable names, display parameters and encoding extension records all included.

This means the resulting .sav opens cleanly in SPSS, PSPP, and any third-party reader that targets the format.

Useful links

Export to SPSS documentation
Jspreadsheet examples