Skip to content

Vanilla JavaScript ​

No framework: mountEditor creates the element in a container and returns the handle plus update(options) and destroy().

ts
import { mountEditor } from 'xlsx-vanilla-viewer';

const editor = mountEditor(document.querySelector('#editor')!, {
	fileName: 'Budget.xlsx',
	onWorkbookChange: (workbook) => console.log(workbook.sheets.length),
	onWorkbookError: (error) => console.error(error),
});
await editor.load(bytes, 'Budget.xlsx');
editor.update({ readOnly: true });
const blob = await editor.save();
editor.destroy();

Or use the element directly:

ts
import { defineXlsxEditor } from 'xlsx-vanilla-viewer';

defineXlsxEditor();
const element = document.createElement('xlsx-editor');
element.setAttribute('locale', 'de');
document.body.append(element);
element.newWorkbook();

See the element API for every attribute, method and event.

See the complete binding contract or try the Vanilla JavaScript demo.

Released under the Apache-2.0 License.