Setup

Install and configure xldx in your project

Setup

Installation

Install xldx using your preferred package manager:

# npm
npm install xldx

# bun
bun add xldx

# yarn
yarn add xldx

# pnpm
pnpm add xldx

Browser Usage

"code-keyword">import { Xldx } "code-keyword">from 'xldx/browser';

"code-keyword">const data = [
{ id: 1, name: 'Item 1', value: 100 },
{ id: 2, name: 'Item 2', value: 200 }
];

"code-keyword">const xldx = "code-keyword">new Xldx(data);
xldx.createSheet(
{ name: 'Sheet1' },
{ key: 'id', header: 'ID', width: 10 },
{ key: 'name', header: 'Name', width: 20 },
{ key: 'value', header: 'Value', width: 15 }
);

// Download file directly
"code-keyword">await xldx.download('data.xlsx');

// Or get as Blob
"code-keyword">const blob = "code-keyword">await xldx.toBlob();

node, bun, or deno Usage

"code-keyword">import { Xldx } "code-keyword">from 'xldx/server';

"code-keyword">const data = [...];

"code-keyword">const xldx = "code-keyword">new Xldx(data);
xldx.createSheet(options, ...columns);

// Write to file
"code-keyword">await xldx.write('output.xlsx');

// Or get as Buffer
"code-keyword">const buffer = "code-keyword">await xldx.toBuffer();

Type Definitions

xldx includes full type definitions for excellent IDE support. No additional configuration needed.

Next Steps