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.
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.
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 columnformat.calendar→ SPSS date value (seconds since 1582-10-14), written asDATE11orDATETIME22depending on whether the format carries a time component.dropdown/autocompletewith{ id, name }numeric sources → nominal numeric variables with value labels wired up automatically.checkbox/radio→ numeric 0/1 withNo/Yesvalue 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:
- Browser —
downloadSavbuilds aBloband triggers a download, no extra libraries needed. - Node.js —
generateSavreturns the bytes directly, ready to pass tofs.writeFilein a backend export pipeline. - Raw datasets —
spss.generate(data, { headers, columns })accepts a plaindata[][]array, so you can produce.savfiles 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.