---
title: "Process spreadsheets in Node.js with Document Authoring"
canonical_url: "https://www.nutrient.io/guides/document-authoring/spreadsheets/nodejs/"
md_url: "https://www.nutrient.io/guides/document-authoring/spreadsheets/nodejs.md"
last_updated: "2026-10-14T00:00:00.000Z"
description: "Convert XLSX files to PDF and SheetJSON on a server with the headless Document Authoring Node.js entry point."
---

# Spreadsheets in Node.js

The Document Authoring Node.js entry point imports, saves, and exports spreadsheets without a browser. Use it to convert XLSX files to PDF or save uploaded XLSX files as SheetJSON.

Before you start, refer to the [Node.js getting started](https://www.nutrient.io/sdk/document-authoring/getting-started/using-nodejs.md) guide for requirements, installation, and TypeScript configuration. Spreadsheet methods use the same system as document methods.

Document Authoring for Node.js is a licensed feature. [Contact Sales](https://www.nutrient.io/contact-sales/) to enable it for production use.

The examples omit error handling. Add it before you use this code in production.

## Convert an XLSX file to PDF

Save this code as `convert-spreadsheet.mjs`. Place `input.xlsx` in the same directory:

```js

import { createDocAuthSystem } from '@nutrient-sdk/document-authoring/node';
import { readFile, writeFile } from 'node:fs/promises';

const system = await createDocAuthSystem();

try {
  const spreadsheet = await system.importSpreadsheet(await readFile(new URL('./input.xlsx', import.meta.url)), {
    format: 'xlsx',
  });

  const pdf = await spreadsheet.export({ format: 'pdf' });
  await writeFile(new URL('./output.pdf', import.meta.url), new Uint8Array(pdf));
} finally {
  system.destroy();
}

```

Run the script with `node convert-spreadsheet.mjs`. The PDF includes every visible sheet. To export one sheet, pass its zero-based index in `sheet`:

```js

const pdf = await spreadsheet.export({ format: 'pdf', sheet: 0 });

```

## Store an XLSX file as SheetJSON

Import the XLSX file and save it as SheetJSON. You can then load and export the saved spreadsheet without the original file:

```js

import { createDocAuthSystem } from '@nutrient-sdk/document-authoring/node';
import { readFile, writeFile } from 'node:fs/promises';

const system = await createDocAuthSystem();

try {
  const imported = await system.importSpreadsheet(await readFile(new URL('./input.xlsx', import.meta.url)), {
    format: 'xlsx',
  });
  const saved = await imported.saveSpreadsheet();
  await writeFile(new URL('./stored.sheetjson', import.meta.url), new Uint8Array(await saved.arrayBuffer()));

  const reopened = await system.loadSpreadsheet(await readFile(new URL('./stored.sheetjson', import.meta.url)));
  const xlsx = await reopened.export({ format: 'xlsx' });
  await writeFile(new URL('./output.xlsx', import.meta.url), new Uint8Array(xlsx));
} finally {
  system.destroy();
}

```

For details about what SheetJSON retains and XLSX export omits, refer to the [save and export](https://www.nutrient.io/guides/document-authoring/spreadsheets/save-and-export.md) guide.

## The spreadsheet editor isn’t available

The `@nutrient-sdk/document-authoring/node` entry point creates systems without a user interface. Calling `createSpreadsheetEditor()` on these systems throws an error.

## Learn more

**[Node.js in production](https://www.nutrient.io/guides/document-authoring/deploy-and-production/nodejs-in-production.md)**\
Scale the system across workers and configure assets on servers.

**[Import and load](https://www.nutrient.io/guides/document-authoring/spreadsheets/import-and-load.md)**\
Learn about import options, progress, and cancellation.

**[Save and export](https://www.nutrient.io/guides/document-authoring/spreadsheets/save-and-export.md)**\
Learn about SheetJSON, XLSX, and PDF output.
---

## Related pages

- [Spreadsheets](/guides/document-authoring/spreadsheets.md)
- [Spreadsheet editor](/guides/document-authoring/spreadsheets/editor.md)
- [Spreadsheet formulas](/guides/document-authoring/spreadsheets/formulas.md)
- [Get started with spreadsheets](/guides/document-authoring/spreadsheets/getting-started.md)
- [Import and load spreadsheets](/guides/document-authoring/spreadsheets/import-and-load.md)
- [Save and export spreadsheets](/guides/document-authoring/spreadsheets/save-and-export.md)
- [Spreadsheet JSON support with SheetJSON](/guides/document-authoring/spreadsheets/sheetjson.md)

