Skip to main content
The workbook model under the facade: cells, sheets and the calculation engine. ExcelWorkbook.model gives it.

Workbook

The workbook’s API for registered functions. Import from @reductoai/xlsx.

Workbook properties

Workbook.create()

A new workbook as Excel makes one: a single empty “Sheet1”.

Workbook.open()

Workbook.activate()

Makes index the open tab and the only selected one.

Workbook.addMedia()

Stores bytes as xl/media/image<n>.<extension> related from owner; returns the relationship id.

Workbook.addPart()

Adds a part related from owner; returns the relationship id.

Workbook.addRelationship()

Relates owner to a part that already exists, or to an external target; returns the id.

Workbook.addSheet()

Workbook.cachedPicture()

A picture of an image some cell of the workbook holds, by its PictureValue.cachedUid.

Workbook.calc()

The calc layer, created on first edit: every sheet loads and every formula registers.

Workbook.cellEdited()

A cell’s content changed; a table header renames its column.

Workbook.circularReferences()

Cells whose formula is on a circular reference, by sheet, row and column. Empty with iteration on, where Excel neither warns nor names a cell.

Workbook.copySheet()

Copies a sheet’s cells, formats, merges, rules, links and drawings to a new sheet at to, with its sheet-level names; a chart that reads the sheet reads the copy. Throws for a sheet with tables, comments, pivot tables or legacy VML.

Workbook.defineFunction()

Registers a function formulas call by name; it comes before a defined name of that name.

Workbook.deleteDefinedName()

Removes a defined name; false when there is none with that name and scope.

Workbook.deleteSheet()

Deletes a worksheet as Excel does: references to it become #REF!, names scoped to it go, a 3D span that ends on it shrinks, and its parts (drawings, comments, tables) are dropped.

Workbook.drawings()

The sheet’s drawing objects in z-order, re-read only when the drawing part changes.

Workbook.ensureStyles()

Writes the style table if the package has none, so every writer of a shared copy starts from the same one.

Workbook.freePart()

${stem}<n>${ext} for the first n at or past this writer’s floor that names no part.

Workbook.functionsSettled()

Resolves when no formula waits for a function’s result: call it before save to keep every result.

Workbook.getSheet()

Workbook.hasPart()

Workbook.importSheet()

Copies source’s sheet index in as name at to: cells, formats, rules, drawings and tables. Comments, pivot tables and controls stay behind, as in Excel on the web.

Workbook.markChanged()

Marks the sheet for rewrite on save after a style-only edit.

Workbook.markDirty()

The formulas inside rect of sheet sheet calculate again at the next recalc.

Workbook.moveSheet()

Moves a worksheet to tab position to; only 3D spans that end on it change.

Workbook.nameAttr()

A defined name’s comment or hidden attribute; set to null to drop it.

Workbook.nextId()

One past the largest of ids inside this writer’s block.

Workbook.noteStructure()

Rows, columns or merges of the sheet changed.

Workbook.onFunctionResults()

listener runs after function results arrive; read the cells again then. Returns the unsubscribe.

Workbook.onShift()

Calls watch after whole rows or columns are inserted (count > 0) or deleted, with the sheet’s part name; a shared session renumbers its cells by it. Returns the unsubscribe.

Workbook.partBytes()

Raw bytes of a package part, such as an image under xl/media.

Workbook.partRels()

Relationships of a part; internal targets are resolved to part names.

Workbook.partText()

Raw text of a package part, or "" when absent; pending style edits are written first.

Workbook.peekCalc()

The calc layer if it exists; reads do not create it.

Workbook.pictureOf()

The picture a cell’s value metadata (vm) points at.

Workbook.pivotTables()

Every pivot table, read from its parts on each call.

Workbook.readCalc()

The calc layer a value read needs: as peekCalc, but a file saved with fullCalcOnLoad creates it.

Workbook.recalc()

Recomputes stale formulas; returns how many cells changed value.

Workbook.recordOperation()

One editor command on this workbook, for analysis; nothing for an unbilled one.

Workbook.refreshFunctions()

Forgets the results of the function name, or of every function, so formulas compute them again.

Workbook.relatedPart()

The part a workbook relationship of this type points at, e.g. /styles.

Workbook.removeFunction()

Drops a registered function; false when none has that name.

Workbook.removePart()

Drops a part and every part only it related.

Workbook.removeRelationship()

Workbook.renameDefinedName()

Renames a defined name and every formula that reads it, as Excel’s Name Manager does.

Workbook.renameSheet()

Renames a sheet and every formula, defined name and chart series that refers to it.

Workbook.restore()

Returns to a snapshot: every sheet reloads and the calc layer is rebuilt on next use.

Workbook.restructure()

Inserts or deletes rows, columns or cells, or cuts cells and pastes them elsewhere, as Excel does: every formula, defined name, merge, conditional format, validation, hyperlink, comment, table, chart series and drawing anchor that addresses a moved cell follows it, and one that addresses a deleted cell becomes #REF!.

Workbook.rewriteFormulas()

Maps every cell, name, table and chart formula through fn.

Workbook.save()

Writes back only the sheets that changed; a stale calc chain is dropped.

Workbook.sessionHost()

Reads and writes beneath the editing API, for a shared session.

Workbook.setDefinedName()

Adds a defined name or gives one new text (file form, no ”=”); sheet scopes it to that worksheet.

Workbook.setImageLoader()

What IMAGE fetches its pictures with. With none, a formula shows the picture the file saved for its address, or #BLOCKED!: a workbook on a server fetches nothing unless told to.

Workbook.setIteration()

Turns iteration on or off and sets its limits. As in Excel, the change recalculates: with iteration on, every circular cell passes up to count times.

Workbook.setNameAttr()

Workbook.setPartBytes()

Stores raw bytes as a part; the caller relates it.

Workbook.setPartText()

Replaces a part’s text; the caller keeps it valid.

Workbook.setSheetVisibility()

Workbook.settle()

Recalculates only when an edit or a stale formula is pending; a read needs no volatile pass.

Workbook.sheet()

Workbook.sheetIndexOf()

Workbook.sheetIndexOfKey()

The sheet with this sheetKey, or -1 once deleted.

Workbook.sheetKey()

A key for a sheet that survives renames, moves and the deletion of other sheets.

Workbook.sheetNameOf()

Workbook.sheetNames()

Workbook.sheetPartName()

Workbook.sheetVisibility()

Excel.SheetVisibility of a sheet, from the state in workbook.xml.

Workbook.snapshot()

The whole workbook as it stands, for restore; parts are shared, not copied.

Workbook.styles()

The editable style table; created on first use, written back on save.

Workbook.tableCellsEdited()

Cells in area were written or cleared as a user does it; typed is one cell entered. A table’s calculated columns follow as in Excel.

Workbook.tableEditor()

Table edits; stale formulas are computed first so a rebuild keeps current values.

Workbook.tableLookup()

Workbook.tables()

Every table of every worksheet, in sheet order.

Workbook.takeChanges()

Cells, sheet structure and parts changed since the last call; a view redraws from these.

Workbook.watchChanges()

A reader of the same edits apart from the view’s: its take leaves takeChanges whole.

Workbook.workbookPartText()

Worksheet

One sheet; rows and columns are zero-based. Import from @reductoai/xlsx.

Worksheet properties

Worksheet.clear()

Worksheet.column()

The column span covering col; widths are in characters.

Worksheet.fillFormula()

One formula over a block, its relative references moving with each cell as Ctrl+Enter does.

Worksheet.formula()

Formula as Excel shows it, or null; a shared-formula child prints its master’s formula from its own cell.

Worksheet.hiddenRows()

How many rows of first..last are hidden.

Worksheet.merge()

Replaces any merge that overlaps rect, as Range.merge does.

Worksheet.picture()

The picture in the cell as stored: Excel’s Place in Cell, or a formula’s picture result.

Worksheet.row()

Worksheet.setArrayFormula()

A legacy (Ctrl+Shift+Enter) array formula over rect.

Worksheet.setColumns()

Worksheet.setDataTable()

A What-If data table over rect, its result cells; attrs is the <f t="dataTable">.

Worksheet.setFormula()

Throws ParseError or LexError when the text is not a formula we read.

Worksheet.setRow()

Worksheet.setRowIndexes()

Rows with properties of their own, in no order.

Worksheet.setRows()

Patches rows first..last; a change in visibility recalculates SUBTOTAL once.

Worksheet.setStyle()

Sets a cell’s xf; a blank cell left with its row’s or column’s xf goes, unless keep.

Worksheet.setValue()

A PictureValue places a picture in the cell, as Insert > Picture > Place in Cell does.

Worksheet.shownFormula()

The formula as Excel shows it in its cell: in a table, references to its own columns drop its name.

Worksheet.spillArea()

The area a dynamic array covers when the cell is its anchor or one it spills into; null outside one or before calc runs.

Worksheet.styleAt()

The xf a cell shows: its own, else its row’s (customFormat), else its column’s, else 0.

Worksheet.unmerge()

Worksheet.value()

Current value; a formula made stale by an edit is recomputed first.

WorkbookCalc

The workbook side: stored values, defined names, and where results go. Import from @reductoai/xlsx.

WorkbookCalc properties

WorkbookCalc.addSheet()

Registers a sheet added after the calc layer was built.

WorkbookCalc.barrier()

A cell no spill may cover: SPILL_TABLE inside a table, SPILL_MERGED in a merged area, else 0.

WorkbookCalc.barriersChanged()

Merges or tables moved: every spill on sheet that covers, or tried to cover, more than its anchor runs again.

WorkbookCalc.cellLoaded()

The cell was rewritten in the store from outside (a shared session): links it again and recalculates what reads it.

WorkbookCalc.cellLoading()

Splits the shared formula the cell belongs to into its own formulas, before the cell is rewritten.

WorkbookCalc.clear()

WorkbookCalc.clearResults()

Clears what every array formula on the sheet put in cells other than its own; a recalc puts it back.

WorkbookCalc.collapseSpills()

Shrinks every spill on sheets to its anchor: spilled values are results, not cells a move or shift carries.

WorkbookCalc.column()

One column’s values indexed by row (blank past the end), after pulling rows r0..r1; null when the source keeps none.

WorkbookCalc.extent()

Rows and columns in use; nothing outside holds a value.

WorkbookCalc.filterChanged()

A filter on the sheet was set or cleared: hidden rows may count as filtered now.

WorkbookCalc.formulaText()

Formula text with =, or null for a constant; a shared-formula child prints its master’s formula from its own cell.

WorkbookCalc.functionsChanged()

A function was registered or dropped: formulas that call it link and calculate again.

WorkbookCalc.name()

A defined name’s formula, or null when none is in scope.

WorkbookCalc.namesChanged()

The defined names changed: every formula that may read one is relinked and recalculated.

WorkbookCalc.parseAt()

Formula text no cell holds, anchored at (row, col); null when it does not parse.

WorkbookCalc.read()

WorkbookCalc.referencesChanged()

A sheet was renamed: INDIRECT text that names it resolves again.

WorkbookCalc.rowFiltered()

Whether a row is hidden by a filter, for SUBTOTAL 1-11.

WorkbookCalc.rowHidden()

Whether a row is hidden, for SUBTOTAL 101-111.

WorkbookCalc.rowVisibilityChanged()

WorkbookCalc.savesAsArray()

The cell’s formula is stored as a dynamic array (t="array" with cm).

WorkbookCalc.scan()

Present cells inside the rectangle, row-major; absent cells are blank.

WorkbookCalc.setArrayFormula()

A legacy (Ctrl+Shift+Enter) array formula over the area; its cells must not hold one already.

WorkbookCalc.setDataTable()

What-If Analysis > Data Table: attrs is the <f t="dataTable"> over area, the result cells.

WorkbookCalc.setFormula()

WorkbookCalc.setValue()

WorkbookCalc.sheetCount()

Worksheets in the workbook, for SHEETS.

WorkbookCalc.sheetIndex()

Worksheet index by name for INDIRECT; -1 when there is none.

WorkbookCalc.sheetName()

WorkbookCalc.spill()

The range a formula at the cell spills into, or null when it is not a spilling anchor.

WorkbookCalc.spilled()

Keeps a dynamic formula’s ref on its area; a typed one becomes a dynamic array once it needs to be.

WorkbookCalc.storedFormula()

text at the cell as the file stores it, and whether it is a dynamic-array formula.

WorkbookCalc.write()

null clears a cell a spill no longer covers; rich comes with a #SPILL! or #CALC! a formula made.

blankWorkbookBytes()

The package of a new Excel workbook with one empty sheet, “Sheet1”. Import from @reductoai/xlsx/blank.