Docs / Guides

Markdown

Excel workbooks

Open .xlsx and .xlsb workbooks, edit them with commands, save .xlsx or print to PDF.

Open, edit, save

const book = ExcelDocument.open(bytes);      // or ExcelDocument.create()book.command({ cmd: 'select', cell: 'B2' });book.command({ cmd: 'enter', text: '1250', then: 'down' });book.command({ cmd: 'enter', text: '=SUM(B2:B6)' });book.command({ cmd: 'format', bold: 'toggle', fill: '#e8f5e9' });const xlsx = book.save();const pdf = book.pdf({ all: true });          // every visible sheet, with its page setupconst sheets = book.pdf({ view: true });      // the sheet pages the viewer keeps annotations on
CommandDoes
select, move, selectAll, home, endSelect cells, ranges or a name; move like the arrow keys
enter, clearType a value or a formula; clear contents, formats or both
format, borders, mergeFonts, colours, fills, alignment, wrapping, number formats; borders; merging
colWidth, rowHeight, autofit, hide, unhideSizes and visibility
insert, deleteRows and columns
sheetAdd, rename, delete, move, duplicate, hide, colour and select sheets
copy, cut, paste, fill, sortClipboard (with paste values or formats), fill handle, sorting
freeze, zoom, grid, findView settings and search
evaluateCalculate a formula without changing the sheet
undo, redo, stateHistory and the current state

Drawing a sheet

render(sheet, x, y, width, height, scale) draws part of a sheet to RGBA pixels, for your own grid. The viewer uses it with tiles.

What is supported

  • About 170 functions, shared and array formulas, defined names, structured references.
  • Conditional formatting (including the Excel 2010 rules), tables with styles and filters, data validation, notes and threaded comments.
  • Number formats, fonts, borders, fills, merges, frozen panes, charts and pictures.
  • .xlsb workbooks open and are saved as .xlsx.