Skip to content

Neovici/nullxlsx

Repository files navigation

NullXlsx

Build Status Maintainability Test Coverage Published on webcomponents.org semantic-release

Minimal JavaScript library to create XLSX spreadsheet and ZIP archive files.

No dependencies, focused on library size only. Weights 10k minimized, 3k zipped.

Example usage

// Data should be array of arrays
var data = [['Title 1', 'Title 2'],
	['Carl', 12.4, new Date(2017, 7 - 1, 10)],
	['Mia', 678, new Date()]
];

// Create xlsx
var xlsx = new NullXlsx('test.xlsx')
	.addSheetFromData(data, 'Sheet name');

// Generate a link to download the file
document.body.appendChild(xlsx.createDownloadLink('Download test.xlsx'));

Distributables

The "dist" directory has three files:

File Size (gz) Description
nullzip.min.js 4k (1.7k) ZIP creator only
nullxlsxonly.min.js 9.9k (3.3k) XLSX creator only (ZIP parts are there but not exposed)
nullxlsx.min.js 10k (3.4k) Both

Development

Currently this is a node module, only to get closure compiler neatly integrated.

There is a doubt that this works with "require".

Make a clone and then run yarn to prepare.

Edit the files in src/.

Compile again by re-running yarn.

Tests

To run tests locally, run yarn test.