Skip to content

WASM API ​

The authoritative TypeScript declarations are shipped as dist/formulon.d.ts. This page summarizes the public shape.

Use the declaration file

When this page and your installed package differ, the dist/formulon.d.ts file in your exact package version is authoritative.

Glossary: status envelope

The Status object returned (directly or as a field) by every fallible WASM call. It carries ok, a numeric status, a human message, and a context field for diagnostics. Cell-level Excel errors are not failed statuses — they are Value objects with kind = Error.

Module ​

ts
import createFormulon from '@libraz/formulon'

const Module = await createFormulon()

@libraz/formulon is the single-threaded entry point. It uses ordinary memory and loads in a browser without cross-origin isolation. Import @libraz/formulon/threads when recalcParallel must use workers; that entry uses the companion @libraz/formulon/formulon_threads.wasm binary and requires cross-origin isolation in browsers. Both entries expose this API and the same declaration file.

createFormulon(opts?) accepts the Emscripten overrides locateFile(path, prefix), print(msg), printErr(msg), noInitialRun, and noExitRuntime. Use locateFile when a bundler serves the .wasm file from a different URL.

The resolved Module carries the library functions and the static Workbook factories; every one of them is listed under Functions and methods. Module.evalFormula(formula) evaluates read-only at Sheet1!A1 of a fresh workbook and reduces an array result to its top-left element. Workbook.createForProfile(profileId) with an unknown id returns a workbook whose isValid() is false, and Workbook.loadBytes(bytes) detects the .xlsx or .xlsb container from the bytes. setLogMinLevel(level) and setLogSink(sink) change process-wide state: the default LogLevel.Off writes nothing, sink(record: Uint8Array) receives one JSON record that is valid only during the call, and null restores the stderr fallback.

The package also exports mergeFunctionMetadata(base, entry, locale) as a named export. It is a pure JavaScript helper that touches no WASM state; see Profiles and formula text.

Result envelopes ​

Fallible calls return Status or an object containing status.

ts
interface Status {
  ok: boolean
  status: number
  message: string
  context: string
}

Excel cell errors are returned as ValueKind.Error. They are not failed Status values.

Numeric accessors such as sheetCount(), every *Count() method, and calcMode() return NumberResult objects with { status, value }. String accessors such as sheetName(), excelProfileId(), localizeFunctionName(), canonicalizeFunctionName(), localizeFormula(), and canonicalizeFormula() return StringResult objects with the same shape. Check status.ok before using value; a zero count or empty string can also be the failure default.

List getters return ListResult<T>, which is the result array itself with a .status property. Read items as result[0]; there is no items or value envelope. spillInfo() returns a SpillInfo object whose status must be checked before its region fields are used.

Every positional argument is checked before any engine call, identically on @libraz/formulon and @libraz/formulon-native. A missing required argument, a value of the wrong type, and a primitive or null where an object is declared throw TypeError; a non-finite, fractional, or out-of-range integer throws RangeError. Neither package substitutes 0, "", false, or an empty object for a missing argument, so setNumber(0, 0, 0), setIterative(true), and addFont(null) throw. A malformed argument that a method reports through its status, such as an array of the wrong length or a callback that is not a function, returns kInvalidArgument (2) on both packages. A validly shaped call that the engine rejects returns Status.ok === false; argument checks leave the workbook unchanged. A string field that holds a lone UTF-16 surrogate is stored with U+FFFD in its place, so the engine never receives ill-formed UTF-8.

Value kinds ​

ts
enum ValueKind {
  Blank,
  Number,
  Bool,
  Text,
  Error,
  Array,
  Ref,
  Lambda
}

getValue() returns a CellResult ({ status, value }), while evalFormula(), evaluateFormulaText(), and evaluateConditionalFormula() return EvalResult envelopes with the same status / value shape. In each case, the value field is a Value whose kind discriminates the payload. Number values use value.number, Booleans use value.boolean (0 or 1), text uses value.text, and errors use value.errorCode — a formulon::ErrorCode ordinal; there is no errorText field (see Error model for what each code means). Array, Ref, and Lambda values carry no payload on Value. To read a lambda's formula text, call getLambdaText(sheet, row, col) on the workbook; use evaluateFormulaArray() for array contents.

The declarations also export these enum groups:

AreaEnums
ValuesValueKind, ErrorCode (Null = 0, Div0 = 1, … Python = 15, Unknown = 16; the ordinal in Value.errorCode and the argument of setError)
Geometry and displayGeometryMode (Display = 0, Print = 1), DisplayStatus (Ok = 0, Overflow = 1, InvalidFormat = 2)
AutoFilterFilterKind, FilterOperator, DynamicFilterType, SortBy, SortMethod, DateTimeGrouping
ValidationValidationErrorStyle (Stop = 0, Warning = 1, Information = 2)
Conditional formatsCfMatchKind (DifferentialFormat = 0, ColorScale = 1, DataBar = 2, IconSet = 3)
Themes and stylesColorContext, ColorResolution, ThemeSource, EffectiveStyleSource
Images and drawingsImageFormat, DrawingObjectKind, AnchorKind, AnchorEditAs
PivotTablesPivotAxis, PivotAggregation, PivotShowValuesAs, PivotFilterType, PivotFilterValueKind, PivotDateGrouping, PivotCalendar, PivotReportLayout, PivotCellKind, plus the constants PIVOT_SHOW_AS_BASE_PREVIOUS / PIVOT_SHOW_AS_BASE_NEXT
Text collationCollationStrength (Compare = 0, Dynamic = 1, ClassicExact = 2)
Workbook stateCalcMode (round-trip metadata only; the engine recalculates dirty cells in every mode), SheetVisibility, WorkbookFormat, ExternalLinkKind
LoggingLogLevel (Debug = 0, Info = 1, Warn = 2, Error = 3, Off = 4)

The filter enums follow the corresponding OOXML ordinals, and ImageFormat identifies Png, Jpeg, Gif, and Bmp in addition to Unknown. See the declaration file for the complete enum members.

Workbook lifecycle ​

ts
const wb = Module.Workbook.loadBytes(bytes)
try {
  if (!wb.isValid()) throw new Error(Module.lastErrorMessage())
  const recalculated = wb.recalc()
  if (!recalculated.ok) throw new Error(recalculated.message)
  const saved = wb.save()
  if (!saved.status.ok || saved.bytes === null) throw new Error(saved.status.message)
} finally {
  wb.delete()
}

Always call delete(). It throws TypeError when it is called while a method of the same workbook is running, for example from a spec getter or a callback, and the handle stays valid. The native package's dispose() follows the same rule.

Container format ​

save() always writes OOXML .xlsx. saveAs(format) writes an explicit container:

ts
enum WorkbookFormat {
  Unknown = 0,
  Xlsx = 1,
  Xlsb = 2
}

const result = wb.saveAs(WorkbookFormat.Xlsb) // SaveResult { status, bytes }

loadBytes(bytes) accepts either container without a separate flag: the loader detects .xlsb vs. .xlsx from the package bytes themselves, not from a file name, so the same call handles both. See File format support for what round-trips through each container.

saveWithDiagnostics(format) returns the saved bytes together with counters for losses and deferred features observed by the writer. readDiagnostics() returns the counters captured when the workbook was loaded. The counters have partial coverage: an all-zero result means that none of the documented losses occurred, not that the package was compared byte-for-byte or that no diagnostic event was logged.

ResultFieldsMeaning
saveWithDiagnosticsdowngradedFormulaCountFormula cells emitted as cached literals; always zero for XLSX.
deferredFeatureCountSheet features not lowered to records; always zero for XLSX.
droppedPartCountPassthrough parts dropped by either writer.
droppedRelationshipCountRelationships dropped because their target part was dropped; this can describe the same loss as droppedPartCount.
renumberedPartCountTables emitted under a writer-assigned part id; always zero for XLSB.
readDiagnosticsundecodedFormulaCountStored formulas that could not be decoded; XLSB only.
undecodedDefinedNameCountDefined names skipped because they could not be decoded; XLSB only.
undecodedPartCountXLSB package parts whose content type could not be resolved.
skippedFeatureCountOOXML presentation-overlay entries skipped because their references were unusable.
unknownContentTypeCountOOXML workbook parts with an unrecognised content type.

Pinned clock ​

NOW(), TODAY(), and pivot relative-period filters read the host clock when the workbook is unpinned. Pin the workbook to one local civil-time reading when those results must agree within a recalculation or be reproducible across hosts:

ts
const check = (status: Status) => {
  if (!status.ok) throw new Error(`${status.message}: ${status.context}`)
}

check(wb.setPinnedNow(2026, 8, 19, 12, 0, 0))
const pin = wb.pinnedNow()
if (!pin.status.ok) throw new Error(pin.status.message)
const now = pin.now // CivilTime | null
check(wb.recalc())
check(wb.clearPinnedNow())

pinnedNow() returns { status, now }. now is a CivilTime object when the workbook is pinned, or null when it follows the host clock or the call fails. setPinnedNow() validates year 1900–9999, the real day range for month 1–12, hour 0–23, and minute / second 0–59; invalid fields return a failed Status rather than being normalised. The values are local civil fields, not a timestamp, so they have no timezone interpretation. Setting or clearing the pin does not recalculate cached formula values; call recalc() explicitly. The pin is workbook model state, not file state: saving does not record it, and a reloaded workbook is unpinned.

Profiles and formula text ​

New workbooks use the win-365-en_US profile. A profile is workbook state: it controls locale-sensitive evaluation, number and date rendering, text comparison, and localized Excel names. Formula input remains the English canonical spelling; use the text helpers to convert a displayed formula before storing it. The profile id is not written into the file, so apply it again after loading. The catalog contains 28 ids, {mac,win}-365-{ja_JP,en_US,de_DE,fr_FR,zh_CN,ko_KR,th_TH,es_ES,es_MX,pt_BR,ru_RU,zh_TW,it_IT,nl_NL}. Locale facts for every mac-* profile and win-365-ja_JP are measured against Excel; the other 13 Windows profiles use estimated locale data.

createDefault() keeps the ordinary one-sheet defaults, including Calibri 11. createForProfile(profileId) also records the selected profile and applies its new-workbook defaults: body and optional phonetic fonts, the Normal style and first-sheet names, cell-xf alignment, phonetic settings, page margins, and the Mac row-height and base-column-width values. It writes no theme part, so a fresh workbook reads as using the default Office theme. The win-* row and column metrics use the engine defaults.

ts
import createFormulon from '@libraz/formulon'

const LocaleModule = await createFormulon()
const profile = 'mac-365-de_DE'
const localeWorkbook = LocaleModule.Workbook.createForProfile(profile)
try {
  // Formula storage remains invariant; these helpers format text for a UI.
  const shown = localeWorkbook.localizeFormula('=SUM(1.5,TRUE)', profile)
  if (!shown.status.ok) throw new Error(shown.status.message)
  const stored = localeWorkbook.canonicalizeFormula(shown.value, profile)
  if (!stored.status.ok) throw new Error(stored.status.message)
  const facts = localeWorkbook.localeFacts(profile)
  if (!facts.status.ok || facts.facts === null) throw new Error(facts.status.message)
} finally {
  localeWorkbook.delete()
}

localizeFormula() rewrites function names, list and array separators, decimal points, Boolean names, and error names. It preserves strings, quoted sheet names, external qualifiers, and structured-reference brackets. canonicalizeFormula() performs the inverse rewrite. Both are pure text transforms and do not validate or install the formula. Use setExcelProfileId() for evaluation behavior and pass stored, en-invariant text to setFormula().

localeFacts() returns separators, Boolean names, date order, currency, and localized error names for the selected profile. Its facts.collationMeasured is true for mac-* profiles and false for every Windows profile, including win-365-ja_JP.

compareText(a, b, strength, profileId) returns { status, order } with order equal to -1, 0, or 1. collationClasses(values, strength, profileId) returns { status, classIds, classCount }: one dense id per input Value, ascending in SORT order and meaningful only within that call. Text collation defines each CollationStrength fold and the class rules.

functionMetadata(name) returns only locale-invariant structure: the canonical name, arity, and availability; the human-readable signature and description fields are empty. functionNames() lists the catalog. A host merges its own display catalog with mergeFunctionMetadata(base, entry, locale), whose BCP-47 UI locale is independent of the engine profile id.

Functions and methods ​

Generated from src/wasm/formulon.d.ts at the reference source revision. Names starting with Module. are on the object createFormulon() resolves to, names starting with Workbook. are static factories, createFormulon and mergeFunctionMetadata are package exports, and every other name is a Workbook instance method. A summary is the first sentence of the declaration's doc comment and is blank where the declaration has none.

Reference source

These tables are generated from the core source for documentation target 0.18.0. The source commit is pinned so WASM, Python, and C declarations describe the same revision. Demos use published packages and display their runtime version separately.

Library, diagnostics and logging ​

NameSignatureDescription
createFormuloncreateFormulon(opts?: FormulonModuleOptions): Promise<FormulonModule>Default export from formulon.js: the Emscripten module factory.
Module.versionStringversionString(): stringLibrary version string (UTF-8).
Module.versionversion(): stringAlias of versionString, matching the Node binding's name.
Module.statusStringstatusString(status: number): stringStatic description of status (e.g. "kOk").
Module.errorDisplayNameerrorDisplayName(errorCode: number): stringExcel display literal for a cell error code (e.g. "#DIV/0!").
Module.lastErrorMessagelastErrorMessage(): stringMost-recent thread-local error message.
Module.lastErrorContextlastErrorContext(): stringMost-recent thread-local error context.
Module.setLogMinLevelsetLogMinLevel(level: number): StatusSets the engine's minimum structured-log severity (a LogLevel ordinal).
Module.setLogSinksetLogSink(sink: ((record: Uint8Array) => void) | null): StatusRoutes structured-log records to sink, or restores the (silent at the default threshold) stderr fallback when sink is null.

Workbook lifecycle and I/O ​

NameSignatureDescription
Workbook.createDefaultcreateDefault(): WorkbookWorkbook with a single default sheet ("Sheet1").
Workbook.createEmptycreateEmpty(): WorkbookWorkbook with no sheets.
Workbook.createForProfilecreateForProfile(profileId: string): WorkbookWorkbook with the new-workbook defaults of an Excel profile id such as "mac-365-ja_JP": font 0 (name, charset, theme-minor scheme), the phonetic font (font 1, CJK locales), the Normal style name, the sheet name, phoneticPr, page margins and, on mac-*, the row height and base column width follow the locale.
Workbook.loadBytesloadBytes(bytes: Uint8Array): WorkbookLoads from an in-memory workbook byte buffer, auto-detecting .xlsx vs .xlsb from the package contents (there is no filename to route on).
isValidisValid(): booleanTrue when the wrapper holds a live native handle.
deletedelete(): voidReleases the native handle.
savesave(): SaveResultSerialises the workbook to an in-memory .xlsx byte stream.
saveAssaveAs(format: WorkbookFormat | number): SaveResultSerialises using an explicit container format (see WorkbookFormat).
saveWithDiagnosticssaveWithDiagnostics(format: WorkbookFormat | number): SaveDiagnosticsResultSerialises using an explicit format and reports loss/defer counters.
readDiagnosticsreadDiagnostics(): ReadDiagnosticsResultReturns the loss counters captured when this handle was loaded.
passthroughCountpassthroughCount(): NumberResultNumber of OOXML parts the reader carried through unchanged.
passthroughAtpassthroughAt(idx: number): PassthroughEntryReads the path of the idx-th passthrough part; kInvalidArgument when idx is out of range.

Sheets and structure ​

NameSignatureDescription
addSheetaddSheet(name: string): StatusAppends a sheet.
removeSheetremoveSheet(index: number): StatusRemoves the sheet at index.
renameSheetrenameSheet(index: number, newName: string): StatusRenames the sheet at index.
moveSheetmoveSheet(fromIdx: number, toIdx: number): StatusMoves the sheet from fromIdx to toIdx (post-removal index).
sheetCountsheetCount(): NumberResultNumber of sheets.
sheetNamesheetName(idx: number): StringResultDisplay name of the sheet at idx; kInvalidArgument when idx is out of range.
activeSheetactiveSheet(): AddStyleResultReturns { status, index }: the sheet the first <workbookView> marks active (activeTab); without workbook views (an XLSB load) the first tab-selected sheet; 0 when neither is recorded.
setActiveSheetsetActiveSheet(sheet: number): StatusMarks sheet sheet active so a save records it, creating a minimal <bookViews> when the workbook has none.
insertRowsinsertRows(sheet: number, row: number, count: number): StatusInserts count rows at row on sheet and rewrites cross-workbook references to follow the shift.
deleteRowsdeleteRows(sheet: number, row: number, count: number): StatusDeletes count rows starting at row on sheet.
insertColsinsertCols(sheet: number, col: number, count: number): StatusInserts count columns at col on sheet.
deleteColsdeleteCols(sheet: number, col: number, count: number): StatusDeletes count columns starting at col on sheet.

Cells ​

NameSignatureDescription
setNumbersetNumber(sheet: number, row: number, col: number, value: number): StatusStores a numeric literal.
setBoolsetBool(sheet: number, row: number, col: number, value: boolean): StatusStores a boolean literal.
setErrorsetError(sheet: number, row: number, col: number, errorCode: number): StatusStores a static Excel error literal; errorCode is an ErrorCode ordinal.
setTextsetText(sheet: number, row: number, col: number, text: string): StatusStores a text literal.
setCellPhoneticsetCellPhonetic(sheet: number, row: number, col: number, phonetic: string): StatusStores (or, when empty, clears) the cell's OOXML phonetic guide (<rPh>).
setCellPhoneticRunssetCellPhoneticRuns(sheet: number, row: number, col: number, runs: PhoneticRun[]): StatusStores (or, when empty, clears) the cell's phonetic guide as one <rPh> block per run.
setCellPhoneticPropertiessetCellPhoneticProperties(sheet: number, row: number, col: number, properties: PhoneticProperties): StatusStores how the cell's guide renders.
setBlanksetBlank(sheet: number, row: number, col: number): StatusStores a blank literal at the cell; equivalent to clearing it.
setFormulasetFormula(sheet: number, row: number, col: number, formula: string): StatusStores a formula.
getValuegetValue(sheet: number, row: number, col: number): CellResultReads the cell's cached value, as of the most recent recalc; call recalc first after mutating cells.
getFormulagetFormula(sheet: number, row: number, col: number): FormulaResultThe stored A1 formula (leading = included), or formula: null for a cell that holds none.
getFormulaR1C1getFormulaR1C1(sheet: number, row: number, col: number): FormulaResultThe formula in R1C1 notation relative to the cell, without a leading =; formula: null when the cell holds none.
getCellsInRangegetCellsInRange(sheet: number, range: MergeRange, cursor?: number | null, limit?: number | null): CellsInRangeResultOne page of the populated cells (formula or non-blank value, spill phantoms included) inside range, row-major.
getLambdaTextgetLambdaText(sheet: number, row: number, col: number): LambdaTextResultRenders the lambda value stored at (sheet, row, col) as Excel formula text.
getCellPhoneticgetCellPhonetic(sheet: number, row: number, col: number): StringResultReturns the cell's OOXML phonetic guide (<rPh>), or an empty string.
getCellPhoneticRunsgetCellPhoneticRuns(sheet: number, row: number, col: number): PhoneticRunsResultReturns the cell's <rPh> blocks with their spans.
getCellPhoneticPropertiesgetCellPhoneticProperties(sheet: number, row: number, col: number): PhoneticPropertiesResultReturns how the cell's guide renders.
cellCountcellCount(sheet: number): NumberResultNumber of written coordinates on sheet: cells set by any value, formula or format setter, setBlank, or a spill anchor commit or rejection (clearing keeps the slot), plus spill phantoms that have no stored slot.
cellAtcellAt(sheet: number, idx: number): CellEntryReads the idx-th counted coordinate, idx in [0, cellCount), ordered by (row, col) ascending.

Recalculation ​

NameSignatureDescription
recalcrecalc(): StatusRecalculates all dirty cells serially on the caller thread.
recalcParallelrecalcParallel(threadCount: number): ParallelRecalcResultRecalculates all dirty cells using the parallel SCC scheduler and returns per-call telemetry.
partialRecalcpartialRecalc(viewport: RecalcViewport): PartialRecalcResultRecalculates only cells touched by the supplied viewport.
setIterativesetIterative(enabled: boolean, maxIterations: number, maxChange: number): StatusSets iterative calculation.
getIterativegetIterative(): IterativeSettingsResultReads back the stored iterative-calculation settings.
setIterativeProgresssetIterativeProgress(callback: IterativeProgressCallback | null): StatusInstalls (or, when passed null, clears) a JS callback invoked after each Gauss-Seidel sweep.
calcModecalcMode(): NumberResult<CalcMode>Workbook-level calc mode (Excel <calcPr calcMode> policy).
setCalcModesetCalcMode(mode: CalcMode): StatusSets the calc mode; only AutoNoTable changes evaluation (recalc() skips the data tables).
fullPrecisionfullPrecision(): NumberResult<calcPr fullPrecision> as 0/1; 0 is "set precision as displayed".
setFullPrecisionsetFullPrecision(fullPrecision: boolean): Status
calcOnSavecalcOnSave(): NumberResult<calcPr calcOnSave> as 0/1 (default 1).
setCalcOnSavesetCalcOnSave(calcOnSave: boolean): Status
refModerefMode(): NumberResult<RefMode><calcPr refMode> as a RefMode code.
setRefModesetRefMode(mode: RefMode): StatusReturns kInvalidArgument for a value outside RefMode.
date1904date1904(): NumberResultThe 1904 date system flag (<workbookPr date1904>) as 0/1.
setDate1904setDate1904(date1904: boolean): StatusSwitches the date system without converting stored serials, so every date shifts by 1462 days.
pinnedNowpinnedNow(): PinnedNowResultThe workbook's pinned wall-clock reading as now, or now: null when it follows the host clock (the default).
setPinnedNowsetPinnedNow(year: number, month: number, day: number, hour: number, minute: number, second: number): StatusPins the workbook clock to a local civil instant; see pinnedNow for the accepted ranges.
clearPinnedNowclearPinnedNow(): StatusReleases the pin so the clock follows the host again.
addDataTableaddDataTable(sheet: number, spec: DataTableSpec): StatusCreates a data table over spec's result range.
getDataTablegetDataTable(sheet: number, row: number, col: number): DataTableResultReads the data table whose result range contains (row, col).
removeDataTableremoveDataTable(sheet: number, row: number, col: number): StatusRemoves the data table containing (row, col) and blanks its result cells.
recalcDataTablesrecalcDataTables(): StatusRecomputes every data table now, whatever the calc mode.

Read-only evaluation ​

NameSignatureDescription
Module.evalFormulaevalFormula(formula: string): EvalResultConvenience: evaluates formula read-only against a fresh single-sheet workbook, anchored at Sheet1!A1.
evaluateFormulaTextevaluateFormulaText(sheet: number, row: number, col: number, formula: string): EvalResultEvaluates formula as if entered at (sheet, row, col) and returns a single scalar result, without mutating the workbook.
evaluateFormulaArrayevaluateFormulaArray(sheet: number, row: number, col: number, formula: string): EvalArrayResultEvaluates formula as if entered at (sheet, row, col) and returns the whole multi-cell result without mutating the workbook.
evaluateConditionalFormulaevaluateConditionalFormula(sheet: number, row: number, col: number, anchorRow: number, anchorCol: number, formula: string): EvalResultEvaluates formula as a conditional-formatting predicate anchored at (sheet, row, col), with relative references written relative to (anchorRow, anchorCol) (the CF-applied range's top-left).

Profiles, locale and text ​

NameSignatureDescription
mergeFunctionMetadatamergeFunctionMetadata(base: FunctionMetadataResult, entry: FunctionMetadataEntry | undefined, locale: string): MergedFunctionMetadataResultMerges a host-supplied FunctionMetadataEntry over the engine's structural functionMetadata() result.
excelProfileIdexcelProfileId(): StringResult<ExcelProfileId>Full formula-behaviour profile id.
setExcelProfileIdsetExcelProfileId(profileId: ExcelProfileId): StatusSelects the formula-behaviour profile; kInvalidArgument for an id that is not an ExcelProfileId.
functionMetadatafunctionMetadata(name: string): FunctionMetadataResultReturns metadata for the function name (case-insensitive).
functionNamesfunctionNames(): ListResult<string>Returns every registered function's canonical name in ascending sort order.
localizeFunctionNamelocalizeFunctionName(canonicalName: string, profileId: ExcelProfileId): StringResultReturns the localized display name for the canonical function canonicalName under profileId.
canonicalizeFunctionNamecanonicalizeFunctionName(localizedName: string, profileId: ExcelProfileId): StringResultInverse of localizeFunctionName: returns the canonical English name for the localized function localizedName under profileId.
localizeFormulalocalizeFormula(formula: string, profileId: ExcelProfileId): StringResultRewrites stored (en-invariant) formula text into profileId's Excel spelling: function names, list / array separators, decimal points, booleans and error names.
canonicalizeFormulacanonicalizeFormula(formula: string, profileId: ExcelProfileId): StringResultInverse of localizeFormula: rewrites profileId-spelled formula text into the en-invariant form.
localeFactslocaleFacts(profileId: ExcelProfileId): LocaleFactsResultReturns the locale facts (separators, boolean names, date order, currency, error names) of profileId.
compareTextcompareText(a: string, b: string, strength: CollationStrength, profileId: ExcelProfileId): CompareTextResultCompares two texts under profileId and returns the sign of the result in order.
collationClassescollationClasses(values: Value[], strength: CollationStrength, profileId: ExcelProfileId): CollationClassesResultClassifies values into collation-ordered equivalence classes under profileId.

Defined names ​

NameSignatureDescription
definedNameCountdefinedNameCount(): NumberResultNumber of defined names, workbook- and sheet-scoped alike.
definedNameAtdefinedNameAt(idx: number): DefinedNameEntryReads the idx-th defined name with its scope; kInvalidArgument when idx is out of range.
setDefinedNamesetDefinedName(name: string, formula: string): StatusAdds, replaces, or (when formula is empty) removes a workbook- scoped defined name.
setDefinedNameScopedsetDefinedNameScoped(name: string, formula: string, localSheetId: number): StatusAdds, replaces, or removes a defined name in workbook scope (-1) or a sheet-local scope (0-based sheet index).
setDefinedNameAttrssetDefinedNameAttrs(name: string, localSheetId: number, attrs: { comment?: string; hidden?: boolean }): StatusSets the comment and / or hidden of an existing defined name in the given scope; an omitted key leaves that attribute unchanged.

Tables ​

NameSignatureDescription
tableCounttableCount(): NumberResultNumber of worksheet tables in the workbook.
tableAttableAt(idx: number): TableEntryReads the idx-th table's identifying metadata; kInvalidArgument when idx is out of range.
createTablecreateTable(input: TableInput): AddStyleResultCreates a worksheet table; index of the result is its workbook-wide table index (see tableAt).
updateTableupdateTable(idx: number, input: TableUpdateInput): StatusPartially updates a table.
removeTableremoveTable(idx: number): StatusRemoves the table at idx.
tableStyleCounttableStyleCount(): NumberResultNumber of custom table / PivotTable styles (<tableStyles>).
getTableStylegetTableStyle(index: number): TableStyleResultReads the custom table style at index.
setTableStylesetTableStyle(style: TableStyle): StatusAdds a custom table style, or replaces the one with the same name (case-insensitive).
removeTableStyleremoveTableStyle(name: string): StatusRemoves the custom table style name.
getTableStyleDefaultsgetTableStyleDefaults(): TableStyleDefaultsResultReads the default table and PivotTable style names.
setTableStyleDefaultssetTableStyleDefaults(defaults: { tableStyle?: string; pivotStyle?: string }): StatusSets the default style names; an omitted field keeps its default and an empty string removes it.

Dependencies, spills and external links ​

NameSignatureDescription
getExternalLinksgetExternalLinks(): ListResult<ExternalLinkRecord>Returns every external-link record carried by the workbook in <externalReferences> document order.
precedentsprecedents(sheet: number, row: number, col: number, depth: number): ListResult<CellNode>Returns the cells that (sheet, row, col) directly reads (1-step precedents) when depth <= 1, or every cell reached within depth BFS steps otherwise.
dependentsdependents(sheet: number, row: number, col: number, depth: number): ListResult<CellNode>Returns the cells that read (sheet, row, col) directly (1-step dependents).
spillInfospillInfo(sheet: number, row: number, col: number): SpillInfoReturns dynamic-array spill info for (sheet, row, col).

Sheet view and protection ​

NameSignatureDescription
getCellShowPhoneticgetCellShowPhonetic(sheet: number, row: number, col: number): CellShowPhoneticResultReads the cell's "Show Phonetic" flag (<c ph="1">); false for an absent cell.
setCellShowPhoneticsetCellShowPhonetic(sheet: number, row: number, col: number, show: boolean): StatusSets the cell's "Show Phonetic" display flag.
getSheetViewgetSheetView(sheet: number): SheetViewResultReads the full per-sheet view (zoom, freeze, tab-hidden, and the display / orientation flags).
setSheetZoomsetSheetZoom(sheet: number, zoomScale: number): StatusSets the sheet zoom percentage (clamped to [10, 400]).
setSheetFreezesetSheetFreeze(sheet: number, freezeRows: number, freezeCols: number): StatusSets the frozen pane in (rows, cols).
setSheetTabHiddensetSheetTabHidden(sheet: number, hidden: boolean): StatusSets the sheet tab's hidden flag — the two-state view of setSheetVisibility.
setSheetVisibilitysetSheetVisibility(sheet: number, visibility: SheetVisibility): StatusSets the sheet tab's visibility to one of the three states.
setSheetShowGridLinessetSheetShowGridLines(sheet: number, show: boolean): StatusSets the sheet's showGridLines flag.
setSheetShowRowColHeaderssetSheetShowRowColHeaders(sheet: number, show: boolean): StatusSets the sheet's showRowColHeaders flag.
setSheetShowZerossetSheetShowZeros(sheet: number, show: boolean): StatusSets the sheet's showZeros flag.
setSheetShowFormulassetSheetShowFormulas(sheet: number, show: boolean): StatusSets the sheet's showFormulas flag.
setSheetShowOutlineSymbolssetSheetShowOutlineSymbols(sheet: number, show: boolean): StatusSets the sheet's showOutlineSymbols flag.
setSheetRightToLeftsetSheetRightToLeft(sheet: number, rightToLeft: boolean): StatusSets the sheet's rightToLeft flag.
setSheetTabSelectedsetSheetTabSelected(sheet: number, selected: boolean): StatusSets the sheet's tabSelected flag.
setSheetTopLeftsetSheetTopLeft(sheet: number, row: number, col: number): StatusSets the sheet view's scroll origin (<sheetView topLeftCell>).
setSheetPaneTopLeftsetSheetPaneTopLeft(sheet: number, row: number, col: number): StatusSets the first visible cell of a frozen or split view's lower-right pane.
setSheetSplitsetSheetSplit(sheet: number, xTwips: number, yTwips: number): StatusSplits the view at xTwips / yTwips (0 for none on that axis; 0, 0 removes the split).
getSheetSelectiongetSheetSelection(sheet: number): SheetSelectionResultReads the active pane's selection (active cell and ranges).
setSheetSelectionsetSheetSelection(sheet: number, selection: SheetSelection): StatusReplaces the active pane's selection.
setSheetViewModesetSheetViewMode(sheet: number, mode: string): StatusSets the sheet's <sheetView view="..."> mode: "", "pageBreakPreview", or "pageLayout".
getSheetProtectiongetSheetProtection(sheet: number): SheetProtectionResultReads the sheet's <sheetProtection> flags.
setSheetProtectionsetSheetProtection(sheet: number, protection: SheetProtection): StatusReplaces the sheet's <sheetProtection> flags wholesale.
getWorkbookProtectiongetWorkbookProtection(): WorkbookProtectionResultReads the workbook's <workbookProtection>; every field is zero or empty when absent.
setWorkbookProtectionsetWorkbookProtection(protection: WorkbookProtection): StatusReplaces the modelled <workbookProtection> attributes.
getProtectedRangesgetProtectedRanges(sheet: number): ListResult<ProtectedRange>Returns the protected ranges of sheet in file order.
addProtectedRangeaddProtectedRange(sheet: number, range: ProtectedRange): StatusAppends a protected range.
updateProtectedRangeupdateProtectedRange(sheet: number, index: number, range: ProtectedRange): StatusReplaces protected range index.
removeProtectedRangeremoveProtectedRange(sheet: number, index: number): StatusRemoves protected range index.

Rows, columns and geometry ​

NameSignatureDescription
setTableColumnTotalssetTableColumnTotals(idx: number, column: number, totals: TableColumnTotalsInput): StatusSets column column's totals-row function and label.
getSheetColumnsgetSheetColumns(sheet: number): ColumnsResultReturns the column-layout overrides on sheet in storage order.
setColumnWidthsetColumnWidth(sheet: number, first: number, last: number, width: number): StatusSets / replaces the column width override on [first, last].
setColumnHiddensetColumnHidden(sheet: number, first: number, last: number, hidden: boolean): StatusSets / replaces the column hidden flag on [first, last].
setColumnOutlinesetColumnOutline(sheet: number, first: number, last: number, level: number): StatusSets / replaces the column outline level on [first, last].
setColumnCollapsedsetColumnCollapsed(sheet: number, first: number, last: number, collapsed: boolean): StatusSets / clears the column collapsed flag on [first, last].
setColumnStylesetColumnStyle(sheet: number, first: number, last: number, xfIndex: number): StatusSets / replaces the cell-style XF on [first, last]; index 0 is the default XF.
clearColumnStyleclearColumnStyle(sheet: number, first: number, last: number): StatusRemoves the cell-style XF on [first, last], retaining other column attributes.
getSheetRowOverridesgetSheetRowOverrides(sheet: number): RowsResultReturns the row-layout overrides on sheet.
setRowHeightsetRowHeight(sheet: number, row: number, height: number): StatusSets / replaces the row height override at row.
setRowHiddensetRowHidden(sheet: number, row: number, hidden: boolean): StatusSets / replaces the row hidden flag at row.
setRowOutlinesetRowOutline(sheet: number, row: number, level: number): StatusSets / replaces the row outline level at row.
setRowCollapsedsetRowCollapsed(sheet: number, row: number, collapsed: boolean): StatusSets / clears the row collapsed flag at row.
setRowStylesetRowStyle(sheet: number, first: number, last: number, xfIndex: number): StatusSets / replaces the cell-style XF of the inclusive row span first..last; index 0 is the default XF.
clearRowStyleclearRowStyle(sheet: number, first: number, last: number): StatusRemoves the cell-style XF of the inclusive row span first..last, retaining other row attributes.
clearRowHeightclearRowHeight(sheet: number, row: number): StatusRemoves the height override at row, returning it to the sheet default.
clearColumnWidthclearColumnWidth(sheet: number, first: number, last: number): StatusRemoves the width override on columns first..last, returning them to the sheet default width.
getSheetFormatDefaultsgetSheetFormatDefaults(sheet: number): SheetFormatDefaultsResultReads the sheet's default column / row metrics.
setSheetFormatDefaultssetSheetFormatDefaults(sheet: number, defaults: Partial<SheetFormatDefaults>): StatusReplaces the sheet's default column / row metrics.
getCellRectPtgetCellRectPt(sheet: number, range: MergeRange, mode: GeometryMode): CellRectResultRectangle covering the inclusive cell range, in points from the top-left of A1.
getColumnWidthPtgetColumnWidthPt(sheet: number, col: number, mode: GeometryMode): NumberResultEffective column width in points; zero when hidden.
getRowHeightPtgetRowHeightPt(sheet: number, row: number): NumberResultEffective row height in points; zero when hidden.
getWidthModelgetWidthModel(sheet: number, mode: GeometryMode): WidthModelResultThe character-unit to point conversion model for the workbook's Normal font.
columnCharsToPtcolumnCharsToPt(sheet: number, mode: GeometryMode, chars: number): NumberResultConverts a stored column width (padding included) to points, snapped to whole screen pixels.
columnPtToCharscolumnPtToChars(sheet: number, mode: GeometryMode, pt: number): NumberResultInverse of columnCharsToPt: the stored width Excel writes for a column of pt.

Display text ​

NameSignatureDescription
getDisplayTextgetDisplayText(sheet: number, row: number, col: number): DisplayTextResultThe text Excel displays for the cell, from its value and number format under the workbook's date system.
formatValueformatValue(value: Value, formatCode: string): DisplayTextResultRenders value (blank, number, boolean, text or error) under the stored-form number format formatCode; empty means General.

Styles ​

NameSignatureDescription
rangeStyleBasesrangeStyleBases(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number): RangeStyleBasesResultLists, ascending, every cell-XF index some cell of the selection resolves to: the XFs of cells that carry their own, then the row, column or default (0) style of the rest.
remapRangeStyleremapRangeStyle(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number, fromXfs: number[], toXfs: number[]): StatusSecond step of the attribute patch: every cell of the selection ends at toXfs[i] where it resolved to fromXfs[i] before; an XF not listed is kept.
snapshotRangeStylesnapshotRangeStyle(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number): RangeStyleSnapshotResultCaptures the style state of a selection (covered column or row styles and every stored cell's XF) as opaque, versioned bytes for restoreRangeStyle; use it to undo a remapRangeStyle.
restoreRangeStylerestoreRangeStyle(sheet: number, bytes: Uint8Array): StatusPuts a snapshotRangeStyle capture back exactly.
getCellXfIndexgetCellXfIndex(sheet: number, row: number, col: number): CellXfIndexResultReturns { status, xfIndex } for the cell at (sheet, row, col).
setCellXfIndexsetCellXfIndex(sheet: number, row: number, col: number, xfIndex: number): StatusPersists xfIndex on the cell at (sheet, row, col).
clearCellXfIndexclearCellXfIndex(sheet: number, row: number, col: number): StatusRemoves the direct style assignment from the cell at (sheet, row, col) so a blank cell inherits its row / column style again.
setRangeXfIndexsetRangeXfIndex(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number, xfIndex: number): StatusApplies xfIndex across an inclusive rectangle, materialising blank cells so an empty ruled box renders.
getCellXfgetCellXf(xfIndex: number): CellXfResultReturns the resolved XF record at xfIndex.
getFontgetFont(fontIndex: number): FontResultReturns the font record at fontIndex, including its ColorSpec selector.
getFillgetFill(fillIndex: number): FillResultReturns the fill record at fillIndex, including its ColorSpec selectors.
getBordergetBorder(borderIndex: number): BorderResultReturns the border record at borderIndex, including its ColorSpec selectors.
getNumFmtgetNumFmt(numFmtId: number): NumFmtResultReturns the format string registered for numFmtId.
getDxfgetDxf(dxfIndex: number): DxfResultReturns the differential-format record referenced by CF dxfId.
addFontaddFont(record: FontRecord): AddStyleResultAdds a font (deduplicating against existing entries) and returns the resolved index.
setFontsetFont(fontIndex: number, record: FontRecord): StatusOverwrites the font at fontIndex in place.
setDefaultFontsetDefaultFont(record: FontRecord): StatusDeclares the workbook's default font: font 0, the record an unstyled cell resolves to.
addFilladdFill(record: FillRecord): AddStyleResultAdds a fill (deduplicating against existing entries).
addBorderaddBorder(record: BorderRecord): AddStyleResultAdds a border (deduplicating against existing entries).
addNumFmtaddNumFmt(formatCode: string): AddNumFmtResultAdds a number-format code.
addXfaddXf(record: CellXf): AddStyleResultAdds an <xf> record (deduplicating against existing entries).
addDxfaddDxf(record: DxfRecord): AddStyleResultAdds a <dxf> differential-format record for conditional formats.
fontCountfontCount(): NumberResultReturns the number of font records currently registered.
fillCountfillCount(): NumberResultReturns the number of fill records currently registered.
borderCountborderCount(): NumberResultReturns the number of border records currently registered.
xfCountxfCount(): NumberResultReturns the number of <xf> records currently registered.
dxfCountdxfCount(): NumberResultReturns the number of <dxf> records available for CF dxfId.
cellStyleCountcellStyleCount(): NumberResultReturns the number of named cell styles (<cellStyle> entries) registered.
cellStyleXfCountcellStyleXfCount(): NumberResultReturns the number of <cellStyleXfs> records — the named-style xf table referenced by CellStyleResult.xfId.
getCellStylegetCellStyle(index: number): CellStyleResultReturns the named cell style at index.
getCellStyleXfgetCellStyleXf(index: number): CellXfResultReturns the named-style xf record at index.
addCellStyleXfaddCellStyleXf(record: CellXf): AddStyleResultAppends (deduplicating) a named-style xf and returns its <cellStyleXfs> index, which is what setCellStyle and CellXf.xfId reference.
setCellStylesetCellStyle(record: CellStyleRecord): StatusAdds or replaces the <cellStyle> entry named record.name.
removeCellStyleremoveCellStyle(name: string): StatusRemoves the <cellStyle> named name; cell formats that used it are repointed at the Normal style.
getEffectiveStylegetEffectiveStyle(sheet: number, row: number, col: number): EffectiveStyleResultThe formatting a cell shows: the xf chosen from cell, row, column or the default, with its colours resolved.

Themes and colors ​

NameSignatureDescription
getThemegetTheme(): ThemeResultThe 12 theme colours (clrScheme order) and the theme typefaces.
setThemeColorssetThemeColors(colors: number[]): StatusRewrites the 12 scheme colours (clrScheme order, alpha ignored).
setThemeFontssetThemeFonts(fonts: ThemeFonts): StatusRewrites the theme's major and minor typefaces.
setThemeScriptFontsetThemeScriptFont(major: boolean, script: string, typeface: string): StatusSets one script's typeface in the major (major true) or minor font set; other scripts are unchanged and an unknown script is appended.
resetThemeresetTheme(): StatusRemoves the theme part so the workbook reports the default theme (source is Default).
resolveColorresolveColor(spec: ColorSpec, context: ColorContext): ResolvedColorResultResolves a colour specification to ARGB against the theme and the indexed palette; context decides what an automatic colour means.

Merges ​

NameSignatureDescription
addMergeaddMerge(sheet: number, range: MergeRange): StatusAdds a merge range to sheet.
removeMergeremoveMerge(sheet: number, range: MergeRange): StatusRemoves every merge that overlaps range (inclusive).
removeMergeAtremoveMergeAt(sheet: number, index: number): StatusRemoves the merge at index.
clearMergesclearMerges(sheet: number): StatusDrops every merge on sheet.
getMergesgetMerges(sheet: number): ListResult<MergeRange>Returns every merge range on sheet as a JS array.
getMergesInRangegetMergesInRange(sheet: number, range: MergeRange): ListResult<MergeRange>Returns the merge ranges on sheet that intersect range, in storage order.
NameSignatureDescription
getCommentgetComment(sheet: number, row: number, col: number): CommentEntry | nullReturns the cell comment at (sheet, row, col), or null when absent.
getCommentResultgetCommentResult(sheet: number, row: number, col: number): CommentResultReturns a comment lookup result that distinguishes absence from an invalid sheet or handle.
getCommentsgetComments(sheet: number): ListResult<SheetCommentEntry>Returns every comment on sheet, including comments anchored on cells that carry no value.
setCommentsetComment(sheet: number, row: number, col: number, author: string, text: string): StatusSets / replaces the cell comment.
getCommentVisiblegetCommentVisible(sheet: number, row: number, col: number): NumberResultWhether the note at (sheet, row, col) is shown without hovering (value 0 or 1).
setCommentVisiblesetCommentVisible(sheet: number, row: number, col: number, visible: boolean): StatusShows or hides the note at (sheet, row, col); its box geometry is kept.
addHyperlinkaddHyperlink(sheet: number, row: number, col: number, target: string, display: string, tooltip: string, location: string): StatusAppends a hyperlink to sheet.
addHyperlinkRangeaddHyperlinkRange(sheet: number, row: number, col: number, lastRow: number, lastCol: number, target: string, display: string, tooltip: string, location: string): StatusAppends a hyperlink covering the inclusive rectangle from (row, col) through (lastRow, lastCol).
removeHyperlinkremoveHyperlink(sheet: number, row: number, col: number): StatusRemoves every hyperlink anchored at (row, col).
removeHyperlinkAtremoveHyperlinkAt(sheet: number, index: number): StatusRemoves the hyperlink at index.
clearHyperlinksclearHyperlinks(sheet: number): StatusDrops every hyperlink on sheet.
getHyperlinksgetHyperlinks(sheet: number): ListResult<HyperlinkEntry>Returns every hyperlink on sheet as a JS array.

Threaded comments and persons ​

NameSignatureDescription
getThreadedCommentsgetThreadedComments(sheet: number): ThreadedCommentsResultLists the sheet's threaded comments, replies included.
addThreadedCommentaddThreadedComment(sheet: number, comment: Partial<ThreadedComment> & Pick<ThreadedComment, 'id' | 'text'>): StatusAdds a threaded comment.
editThreadedCommenteditThreadedComment(sheet: number, id: string, text: string, mentions: Mention[]): StatusReplaces the text and mentions of the comment with id.
setThreadResolvedsetThreadResolved(sheet: number, threadId: string, done: boolean): StatusSets the resolved state of the thread opened by threadId.
removeThreadedCommentremoveThreadedComment(sheet: number, id: string): StatusRemoves a comment; removing an opening comment removes its thread.
getPersonsgetPersons(): PersonsResultLists the workbook's persons.
addPersonaddPerson(person: Person): StatusAppends a person to the workbook's person list.
removePersonremovePerson(id: string): StatusFails while a threaded comment or mention still names the person.

AutoFilter ​

NameSignatureDescription
getSheetAutoFilterXmlgetSheetAutoFilterXml(sheet: number): SheetAutoFilterXmlResultReads the complete worksheet-level <autoFilter> XML fragment.
setSheetAutoFilterXmlsetSheetAutoFilterXml(sheet: number, xml: string): StatusReplaces the worksheet-level <autoFilter> XML fragment; empty clears it.
getAutoFiltergetAutoFilter(sheet: number): AutoFilterResultReads the sheet's typed AutoFilter; autoFilter is null when absent.
setAutoFiltersetAutoFilter(sheet: number, filter: AutoFilter): StatusReplaces the sheet AutoFilter and its hidden _xlnm._FilterDatabase name.
removeAutoFilterremoveAutoFilter(sheet: number): StatusRemoves the sheet AutoFilter.
applyAutoFilterapplyAutoFilter(sheet: number): StatusHides every body row the criteria exclude and shows the rest, as Excel's Reapply does.
clearAutoFilterclearAutoFilter(sheet: number): StatusDrops every column criterion and shows all body rows.
evaluateAutoFilterevaluateAutoFilter(sheet: number): AutoFilterEvalResultEvaluates the sheet AutoFilter without changing the sheet.
getTableAutoFiltergetTableAutoFilter(table: number): AutoFilterResultTable counterparts, addressed by the workbook-wide table index (tableAt).
setTableAutoFiltersetTableAutoFilter(table: number, filter: AutoFilter): StatusReplaces the table's AutoFilter.
removeTableAutoFilterremoveTableAutoFilter(table: number): StatusRemoves the table's AutoFilter.
applyTableAutoFilterapplyTableAutoFilter(table: number): StatusHides every body row the table's criteria exclude and shows the rest.
clearTableAutoFilterclearTableAutoFilter(table: number): StatusDrops every column criterion and shows all body rows.
evaluateTableAutoFilterevaluateTableAutoFilter(table: number): AutoFilterEvalResultEvaluates the table's AutoFilter without changing the sheet.

Data validation ​

NameSignatureDescription
validateValuevalidateValue(sheet: number, row: number, col: number, value: Value): ValidationOutcomeResultChecks value against the validation rule covering (row, col) without storing it.
listInvalidCellslistInvalidCells(sheet: number, cursor?: number | null, limit?: number | null): CellsInRangeResultEnumerates populated cells whose value fails their validation rule, in row-major order, one page at a time; paging as getCellsInRange.
getValidationsgetValidations(sheet: number): ListResult<DataValidationEntry>Returns every data-validation rule on sheet in storage order.
addValidationaddValidation(sheet: number, validation: DataValidationInput): StatusAppends a data-validation rule to sheet.
removeValidationAtremoveValidationAt(sheet: number, index: number): StatusRemoves the validation rule at index.
clearValidationsclearValidations(sheet: number): StatusDrops every validation rule on sheet.

Conditional formats ​

NameSignatureDescription
evaluateCfRangeevaluateCfRange(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number, todaySerial: number): CfRangeResultEvaluates every CF block on sheet against the inclusive range [(firstRow, firstCol), (lastRow, lastCol)].
getConditionalFormatsgetConditionalFormats(sheet: number): ListResult<ConditionalFormatEntry>Returns every CF rule on sheet in flattened priority order.
addConditionalFormataddConditionalFormat(sheet: number, rule: ConditionalFormatInput): AddStyleResultAppends a new single-rule <conditionalFormatting> block to sheet, including visual rules when their payload object is supplied.
removeConditionalFormatAtremoveConditionalFormatAt(sheet: number, index: number): StatusRemoves the CF rule at index (flattened order).
clearConditionalFormatsclearConditionalFormats(sheet: number): StatusDrops every CF block on sheet.

Images and drawings ​

NameSignatureDescription
probeImageprobeImage(bytes: Uint8Array): ImageInfoResultSniffs the format and pixel size of PNG, JPEG, GIF or BMP bytes without touching the workbook.
listDrawingObjectslistDrawingObjects(sheet: number): ListResult<DrawingObject>Lists the anchored objects of the sheet's drawing, in document order.
getImagegetImage(sheet: number, objectId: number): ImageResultReturns a copy of the media bytes of the picture objectId.
insertImageinsertImage(sheet: number, bytes: Uint8Array, opts?: ImageInsertOptions): InsertImageResultInserts bytes as a picture; existing drawing content is kept.
removeDrawingremoveDrawing(sheet: number, objectId: number): StatusRemoves the picture or chart objectId and the parts only it reaches; other drawing content is kept.
setDrawingAnchorsetDrawingAnchor(sheet: number, objectId: number, placement: ImagePlacement): StatusMoves and resizes the picture or chart objectId, keeping its id, crop, rotation and every other element.
setDrawingZOrdersetDrawingZOrder(sheet: number, objectId: number, index: number): StatusMakes the picture or chart objectId item index of listDrawingObjects, whose order is the stacking order (0 is the back).
snapshotDrawingsnapshotDrawing(sheet: number, objectId: number): ImageSnapshotResultCaptures the picture or chart objectId with its list position, element and dependent parts as opaque bytes for restoreDrawing.
restoreDrawingrestoreDrawing(sheet: number, bytes: Uint8Array, opts?: RestoreImageOptions): InsertImageResultPuts a snapshotDrawing capture back and returns the object's id: in place of an object with the same id at its recorded position, or as a copy on top with newId.
listShapeslistShapes(sheet: number): ListResult<Shape>Lists the shapes, connectors and groups of the sheet's drawing in z-order (back first); children of a group are not listed.
insertShapeinsertShape(sheet: number, spec: ShapeInput): InsertImageResultAppends a shape on top and returns its id; a sheet without a drawing gets one and existing drawing content is kept.
updateShapeupdateShape(sheet: number, objectId: number, spec: ShapeInput): StatusApplies the fields spec names to the shape objectId; every other part of its XML is kept.
removeShaperemoveShape(sheet: number, objectId: number): StatusRemoves the shape, connector or group objectId with its children.
listSlicerslistSlicers(sheet: number): ListResult<Slicer>Lists the table slicers the sheet hosts; slicers over a pivot cache are not listed.
addSliceraddSlicer(sheet: number, table: number, column: number, spec: SlicerInput): InsertImageResultAdds a slicer over column column (0-based) of table table and returns its frame's id.
updateSlicerupdateSlicer(sheet: number, index: number, spec: SlicerInput): StatusApplies the fields spec names to slicer index; every other part of its XML is kept.
removeSlicerremoveSlicer(sheet: number, index: number): StatusRemoves slicer index with its drawing frame, and its cache when no other slicer uses it.
listSparklineGroupslistSparklineGroups(sheet: number): ListResult<SparklineGroup>Lists the sheet's sparkline groups in document order with their sparklines.
addSparklineGroupaddSparklineGroup(sheet: number, spec: SparklineGroupInput): StatusAppends a group; spec.sparklines must hold at least one sparkline.
updateSparklineGroupupdateSparklineGroup(sheet: number, index: number, spec: SparklineGroupInput): StatusRewrites the modelled attributes, colours and date range of group index; its sparklines and unmodelled XML are kept.
setSparklineGroupSparklinessetSparklineGroupSparklines(sheet: number, index: number, sparklines: Sparkline[]): StatusReplaces the sparklines of group index.
removeSparklineGroupremoveSparklineGroup(sheet: number, index: number): StatusRemoves group index.

Charts ​

NameSignatureDescription
getChartgetChart(sheet: number, objectId: number): ChartResultReads the typed view of the chart objectId.
getChartDatagetChartData(sheet: number, objectId: number): ChartDataResultResolves the chart's series against the current cell values.
previewChartDatapreviewChartData(sheet: number, objectId: number, overrides: ChartPreviewOverrides): ChartDataResultResolves the series as if overrides were applied to the chart; the workbook is not changed.
insertChartinsertChart(sheet: number, options: ChartInsertOptions): InsertChartResultCreates a chart with filled caches and returns its object id.
setChartTypesetChartType(sheet: number, objectId: number, plot: number, kind: ChartInsertKind, grouping?: ChartGrouping): StatusReplaces plot group plot with kind; grouping applies to column, bar, line and area.
setChartTitlesetChartTitle(sheet: number, objectId: number, title: string | null | { kind: ChartTitleKind; text?: string; formula?: string }): StatusSets the chart title text, or removes the title with null.
setChartLegendsetChartLegend(sheet: number, objectId: number, position: ChartLegendPosition, overlay: boolean, hiddenSeries?: number[]): StatusSets the legend position (None removes it) and overlay; hiddenSeries (series c:idx values) replaces the hidden legend entries when given.
setChartAxissetChartAxis(sheet: number, objectId: number, axisId: number, patch: ChartAxisPatch): StatusPatches the axis axisId.
setChartDisplaysetChartDisplay(sheet: number, objectId: number, blanksAs: ChartBlanksAs, plotVisibleOnly: boolean | null): StatusSets how blanks are plotted and whether hidden cells are skipped; Absent and null remove the element.
setChartSeriessetChartSeries(sheet: number, objectId: number, plot: number, seriesIdx: number, patch: ChartSeriesPatch): StatusPatches the series with c:idx seriesIdx of plot group plot.
setChartPointsetChartPoint(sheet: number, objectId: number, plot: number, seriesIdx: number, pointIdx: number, patch: ChartPointPatch | null): StatusPatches a data point; null or an empty patch removes its formatting.
setChartPlotsetChartPlot(sheet: number, objectId: number, plot: number, patch: ChartPlotPatch): StatusPatches plot group plot.
setChartFiltersetChartFilter(sheet: number, objectId: number, hiddenSeries: number[], hiddenCategories: number[]): StatusReplaces the chart filter: series by c:idx and categories by position are hidden.
addChartSeriesaddChartSeries(sheet: number, objectId: number, plot: number, patch: ChartSeriesPatch): AddChartSeriesResultAppends a series to plot group plot; the patch must set values (y for a scatter plot).
removeChartSeriesremoveChartSeries(sheet: number, objectId: number, plot: number, seriesIdx: number): StatusRemoves the series with c:idx seriesIdx from plot group plot.
setChartSourcesetChartSource(sheet: number, objectId: number, source: string, direction: ChartSeriesDirection, headerRow?: boolean, headerColumn?: boolean): StatusRebuilds every series from source, keeping the chart kind and each series' formatting by idx, and clears the filter.

Print settings and pagination ​

NameSignatureDescription
paginatepaginate(sheet: number): PaginationResultComputes print-area page breaks and physical page count for sheet.
getSheetPageSetupXmlgetSheetPageSetupXml(sheet: number): SheetPrintXmlResultReads the worksheet's <pageSetup> fragment; empty when absent.
setSheetPageSetupXmlsetSheetPageSetupXml(sheet: number, xml: string): StatusReplaces <pageSetup>; empty removes it and restores the defaults.
getSheetPageMarginsXmlgetSheetPageMarginsXml(sheet: number): SheetPrintXmlResultReads the worksheet's <pageMargins> fragment; empty when absent.
setSheetPageMarginsXmlsetSheetPageMarginsXml(sheet: number, xml: string): StatusReplaces <pageMargins>; empty removes it.
getSheetPrintOptionsXmlgetSheetPrintOptionsXml(sheet: number): SheetPrintXmlResultReads the worksheet's <printOptions> fragment; empty when absent.
setSheetPrintOptionsXmlsetSheetPrintOptionsXml(sheet: number, xml: string): StatusReplaces <printOptions>; empty removes it.
getSheetHeaderFooterXmlgetSheetHeaderFooterXml(sheet: number): SheetPrintXmlResultReads the worksheet's <headerFooter> fragment; empty when absent.
setSheetHeaderFooterXmlsetSheetHeaderFooterXml(sheet: number, xml: string): StatusReplaces <headerFooter>; empty removes it.
getSheetSheetPrXmlgetSheetSheetPrXml(sheet: number): SheetPrintXmlResultReads the worksheet's <sheetPr> fragment; empty when absent.
setSheetSheetPrXmlsetSheetSheetPrXml(sheet: number, xml: string): StatusReplaces <sheetPr>; empty removes it.
setSheetFitToPagesetSheetFitToPage(sheet: number, enabled: boolean): StatusSets or clears <sheetPr><pageSetUpPr fitToPage> without disturbing anything else <sheetPr> carries.
getSheetPrintAreagetSheetPrintArea(sheet: number): SheetPrintAreaResultReads _xlnm.Print_Area as comma-separated A1 ranges.
setSheetPrintAreasetSheetPrintArea(sheet: number, rangesA1: string): StatusWrites _xlnm.Print_Area from one or more comma-separated A1 ranges ("A1:F8", "A1:B10,D5:E20", "A:D").
getSheetPrintTitlesgetSheetPrintTitles(sheet: number): SheetPrintTitlesResultReads _xlnm.Print_Titles as a row span and a column span.
setSheetPrintTitlessetSheetPrintTitles(sheet: number, repeatRows: string, repeatCols: string): StatusWrites _xlnm.Print_Titles.
addSheetRowBreakaddSheetRowBreak(sheet: number, row: number, manual: boolean): StatusUpserts a row break before row, spanning the whole sheet.
addSheetColBreakaddSheetColBreak(sheet: number, col: number, manual: boolean): StatusUpserts a column break before col, spanning the whole sheet.
removeSheetRowBreakremoveSheetRowBreak(sheet: number, row: number): StatusRemoves the row break at row.
removeSheetColBreakremoveSheetColBreak(sheet: number, col: number): StatusRemoves the column break at col.
clearSheetBreaksclearSheetBreaks(sheet: number): StatusRemoves every manual break on both axes.
getSheetRowBreaksgetSheetRowBreaks(sheet: number): SheetPageBreaksResultReturns the row breaks, ascending by row.
getSheetColBreaksgetSheetColBreaks(sheet: number): SheetPageBreaksResultReturns the column breaks, ascending by column.
setSheetPageSetupsetSheetPageSetup(sheet: number, setup: PageSetupInput): StatusApplies a partial <pageSetup> update.
setSheetPageMarginssetSheetPageMargins(sheet: number, margins: PageMarginsInput): StatusApplies a partial <pageMargins> update, in inches.
setSheetPrintOptionssetSheetPrintOptions(sheet: number, options: PrintOptionsInput): StatusApplies a partial <printOptions> update.
setSheetHeaderFootersetSheetHeaderFooter(sheet: number, headerFooter: HeaderFooterInput): StatusApplies a partial <headerFooter> update.
getSheetPageSetupgetSheetPageSetup(sheet: number): SheetPageSetupResultReads the effective page setup and which attributes state it.
getSheetPageMarginsgetSheetPageMargins(sheet: number): SheetPageMarginsResultReads the effective page margins, in inches.

PivotTables ​

NameSignatureDescription
pivotCountpivotCount(sheet: number): NumberResultReturns the number of PivotTables anchored on sheet.
pivotLayoutpivotLayout(sheet: number, pivotIndex: number): PivotLayoutResultEvaluates and projects a PivotTable into concrete grid cells.
pivotCreatepivotCreate(sheet: number, name: string, cacheId: number, anchorRow: number, anchorCol: number): AddStyleResultCreates a new empty pivot table.
pivotRemovepivotRemove(sheet: number, pivotIdx: number): StatusRemoves the pivot table at pivotIdx.
pivotSetNamepivotSetName(sheet: number, pivotIdx: number, name: string): StatusRenames the pivot table.
pivotSetAnchorpivotSetAnchor(sheet: number, pivotIdx: number, anchorRow: number, anchorCol: number, spanRows: number, spanCols: number): StatusUpdates the pivot's anchor cell and span.
pivotSetGrandTotalspivotSetGrandTotals(sheet: number, pivotIdx: number, rowsEnabled: boolean, colsEnabled: boolean): StatusToggles the row / column grand total bands on the pivot.
pivotSetStyleInfopivotSetStyleInfo(sheet: number, pivotIdx: number, info: PivotStyleInfo): StatusSets the pivot's table style and toggles, making the style element present.
pivotGetLayoutpivotGetLayout(sheet: number, pivotIdx: number): PivotReportLayoutResultReads the pivot's compact / tabular / outline report layout.
pivotSetLayoutpivotSetLayout(sheet: number, pivotIdx: number, layout: PivotReportLayout): StatusSets the pivot's compact / tabular / outline report layout.
pivotNamepivotName(sheet: number, pivotIdx: number): StringResultReads the pivot's name.
pivotGetGrandTotalspivotGetGrandTotals(sheet: number, pivotIdx: number): PivotGrandTotalsResultReads the row / column grand total flags pivotSetGrandTotals writes.
pivotGetStyleInfopivotGetStyleInfo(sheet: number, pivotIdx: number): PivotStyleInfoResultReads the table style pivotSetStyleInfo writes.
pivotRowFieldOrderpivotRowFieldOrder(sheet: number, pivotIdx: number): PivotFieldOrderResultReads the row-axis field order (the list pivotSetRowFieldOrder takes).
pivotColFieldOrderpivotColFieldOrder(sheet: number, pivotIdx: number): PivotFieldOrderResultReads the column-axis field order.
pivotFieldCountpivotFieldCount(sheet: number, pivotIdx: number): NumberResultNumber of fields configured on the pivot.
pivotFieldAddpivotFieldAdd(sheet: number, pivotIdx: number, spec: PivotFieldSpec): AddStyleResultPlaces a field on the pivot.
pivotFieldAtpivotFieldAt(sheet: number, pivotIdx: number, fieldIdx: number): PivotFieldResultReads the definition of field fieldIdx.
pivotFieldItemCountpivotFieldItemCount(sheet: number, pivotIdx: number, fieldIdx: number): NumberResultNumber of items in the field's item list (what pivotFieldAddItem / pivotFieldAddItemAt append to).
pivotFieldItemAtpivotFieldItemAt(sheet: number, pivotIdx: number, fieldIdx: number, itemIdx: number): PivotItemResultReads item itemIdx of the field; the index pivotFieldSetItemVisible takes.
pivotFieldClearpivotFieldClear(sheet: number, pivotIdx: number): StatusDrops every field from the pivot, emptying the row and column orders.
pivotFieldSetAxispivotFieldSetAxis(sheet: number, pivotIdx: number, fieldIdx: number, axis: PivotAxis | -1): StatusSets the axis of pivot field fieldIdx.
pivotFieldSetSortpivotFieldSetSort(sheet: number, pivotIdx: number, fieldIdx: number, order: PivotSortOrder, byField: string): StatusSets the sibling order of pivot field fieldIdx.
pivotFieldSetSubtotalToppivotFieldSetSubtotalTop(sheet: number, pivotIdx: number, fieldIdx: number, top: boolean): StatusSets the subtotal_top flag on pivot field fieldIdx.
pivotFieldAddItempivotFieldAddItem(sheet: number, pivotIdx: number, fieldIdx: number, name: string, visible: boolean): StatusAppends a manual-filter item to pivot field fieldIdx, addressed by its label.
pivotFieldAddItemAtpivotFieldAddItemAt(sheet: number, pivotIdx: number, fieldIdx: number, cacheIndex: number, visible: boolean): StatusAppends a manual-filter item to pivot field fieldIdx, addressed by its position in the bound cache field's shared items -- the same index space as OOXML <item x="N">.
pivotFieldClearItemspivotFieldClearItems(sheet: number, pivotIdx: number, fieldIdx: number): StatusDrops every manual-filter item from pivot field fieldIdx.
pivotFieldSetItemVisiblepivotFieldSetItemVisible(sheet: number, pivotIdx: number, fieldIdx: number, itemIdx: number, visible: boolean): StatusToggles the visibility of item itemIdx on field fieldIdx.
pivotFieldAddSubtotalFnpivotFieldAddSubtotalFn(sheet: number, pivotIdx: number, fieldIdx: number, agg: PivotAggregation): StatusAppends a subtotal-fn entry to pivot field fieldIdx.
pivotFieldClearSubtotalFnspivotFieldClearSubtotalFns(sheet: number, pivotIdx: number, fieldIdx: number): StatusDrops every subtotal-fn entry from pivot field fieldIdx.
pivotFieldSetDateGrouppivotFieldSetDateGroup(sheet: number, pivotIdx: number, fieldIdx: number, granularity: PivotDateGrouping, calendar: PivotCalendar, startYear: number, endYear: number, intervalDays?: number, startSerial?: number, endSerial?: number): StatusConfigures date-grouping on pivot field fieldIdx.
pivotFieldClearDateGrouppivotFieldClearDateGroup(sheet: number, pivotIdx: number, fieldIdx: number): StatusRemoves the date-grouping config from pivot field fieldIdx.
pivotFieldSetNumberFormatpivotFieldSetNumberFormat(sheet: number, pivotIdx: number, fieldIdx: number, utf8: string): StatusSets the numFmtId of pivot field fieldIdx, as a decimal string naming a built-in id or one returned by addNumFmt.
pivotSetRowFieldOrderpivotSetRowFieldOrder(sheet: number, pivotIdx: number, indices: ReadonlyArray<number>): StatusReplaces the row-axis field order with indices.
pivotSetColFieldOrderpivotSetColFieldOrder(sheet: number, pivotIdx: number, indices: ReadonlyArray<number>): StatusReplaces the column-axis field order.
pivotDataFieldCountpivotDataFieldCount(sheet: number, pivotIdx: number): NumberResultNumber of <dataField> entries on the pivot.
pivotDataFieldAddpivotDataFieldAdd(sheet: number, pivotIdx: number, spec: PivotDataFieldSpec): AddStyleResultAppends a new data-field entry.
pivotDataFieldAtpivotDataFieldAt(sheet: number, pivotIdx: number, dataFieldIdx: number): PivotDataFieldResultReads data field dataFieldIdx.
pivotDataFieldClearpivotDataFieldClear(sheet: number, pivotIdx: number): StatusDrops every data-field entry from the pivot.
pivotDataFieldSetpivotDataFieldSet(sheet: number, pivotIdx: number, dataFieldIdx: number, spec: PivotDataFieldSpec): StatusReplaces the data-field entry at dataFieldIdx in place.
pivotFilterCountpivotFilterCount(sheet: number, pivotIdx: number): NumberResultNumber of filters on the pivot -- see PivotFilterResult.
pivotFilterAddpivotFilterAdd(sheet: number, pivotIdx: number, spec: PivotFilterSpec): StatusAppends a filter, saved with the pivot; see PivotFilterResult.
pivotFilterAtpivotFilterAt(sheet: number, pivotIdx: number, filterIdx: number): PivotFilterResultReads the filter at filterIdx; see PivotFilterResult.
pivotFilterClearpivotFilterClear(sheet: number, pivotIdx: number): StatusDrops every listed filter from the pivot.
pivotFilterRemoveAtpivotFilterRemoveAt(sheet: number, pivotIdx: number, filterIdx: number): StatusRemoves the filter at filterIdx.

Pivot caches ​

NameSignatureDescription
pivotCacheCountpivotCacheCount(): NumberResultReturns the number of pivot caches owned by the workbook.
pivotCacheIdAtpivotCacheIdAt(idx: number): AddStyleResultReturns { status, index: cacheId } for the cache at flat index idx.
pivotCacheCreatepivotCacheCreate(requestedId: number): AddStyleResultCreates a new empty pivot cache.
pivotCacheRemovepivotCacheRemove(cacheId: number): StatusRemoves the pivot cache with id cacheId.
pivotCacheGetWorksheetSourcepivotCacheGetWorksheetSource(cacheId: number): PivotWorksheetSourceResultReads the cache's worksheet source range / defined-name metadata.
pivotCacheSetWorksheetSourcepivotCacheSetWorksheetSource(cacheId: number, source: PivotWorksheetSource): StatusSets or clears the cache's worksheet source metadata.
pivotCacheFieldCountpivotCacheFieldCount(cacheId: number): NumberResultNumber of fields on the cache identified by cacheId.
pivotCacheFieldNamepivotCacheFieldName(cacheId: number, fieldIdx: number): StringResultReads the name of the cache field at fieldIdx.
pivotCacheFieldAddpivotCacheFieldAdd(cacheId: number, name: string): AddStyleResultAppends a new field with the given UTF-8 name to the cache.
pivotCacheFieldClearpivotCacheFieldClear(cacheId: number): StatusDrops every field (and every record) from the cache.
pivotCacheFieldSharedItemCountpivotCacheFieldSharedItemCount(cacheId: number, fieldIdx: number): NumberResultNumber of shared items configured on cache field fieldIdx.
pivotCacheFieldAddSharedItemNumberpivotCacheFieldAddSharedItemNumber(cacheId: number, fieldIdx: number, value: number): StatusAppends a numeric shared item to cache field fieldIdx.
pivotCacheFieldAddSharedItemTextpivotCacheFieldAddSharedItemText(cacheId: number, fieldIdx: number, value: string): StatusAppends a text shared item to cache field fieldIdx.
pivotCacheFieldAddSharedItemBoolpivotCacheFieldAddSharedItemBool(cacheId: number, fieldIdx: number, value: boolean): StatusAppends a boolean shared item to cache field fieldIdx.
pivotCacheFieldAddSharedItemBlankpivotCacheFieldAddSharedItemBlank(cacheId: number, fieldIdx: number): StatusAppends a blank shared item to cache field fieldIdx.
pivotCacheFieldAddSharedItemErrorpivotCacheFieldAddSharedItemError(cacheId: number, fieldIdx: number, errorCode: number): StatusAppends an Excel error shared item to cache field fieldIdx.
pivotCacheFieldClearSharedItemspivotCacheFieldClearSharedItems(cacheId: number, fieldIdx: number): StatusDrops every shared item from cache field fieldIdx.
pivotCacheRecordCountpivotCacheRecordCount(cacheId: number): NumberResultReturns the number of records on the cache.
pivotCacheRecordAddpivotCacheRecordAdd(cacheId: number): AddStyleResultAppends a new empty record.
pivotCacheRecordClearpivotCacheRecordClear(cacheId: number): StatusDrops every record from the cache.
pivotCacheRecordSetNumberpivotCacheRecordSetNumber(cacheId: number, recordIdx: number, fieldIdx: number, value: number): StatusSets cell (recordIdx, fieldIdx) to a numeric value.
pivotCacheRecordSetTextpivotCacheRecordSetText(cacheId: number, recordIdx: number, fieldIdx: number, value: string): StatusSets cell (recordIdx, fieldIdx) to a UTF-8 text value.
pivotCacheRecordSetBoolpivotCacheRecordSetBool(cacheId: number, recordIdx: number, fieldIdx: number, value: boolean): StatusSets cell (recordIdx, fieldIdx) to a boolean value.
pivotCacheRecordSetBlankpivotCacheRecordSetBlank(cacheId: number, recordIdx: number, fieldIdx: number): StatusSets cell (recordIdx, fieldIdx) to Blank.
pivotCacheRecordSetErrorpivotCacheRecordSetError(cacheId: number, recordIdx: number, fieldIdx: number, errorCode: number): StatusSets cell (recordIdx, fieldIdx) to an Excel error value.
pivotCacheIdpivotCacheId(sheet: number, pivotIdx: number): AddStyleResultReturns { status, index: cacheId }: the cache the pivot draws from.

Method notes ​

cellCount() / cellAt() enumerate written coordinates, including styled blanks, setBlank writes, and spill phantoms. Unwritten gaps are omitted; indices are dense and ordered by (row, col). Do not mutate the sheet during enumeration. This differs from populated-range enumeration; see Inspect a range.

setCellPhoneticRuns() accepts an ordered, non-overlapping UTF-16 partition of the annotated cell text. setCellPhoneticProperties() changes its font, kana form, and alignment independently of those readings; writing a cell value clears both the runs and their properties.

recalcParallel(threadCount) is synchronous and returns { status, stats }. The default @libraz/formulon entry evaluates this call serially and reports stats.workerThreadsStarted === 0. The @libraz/formulon/threads entry starts workers: a count of 0 selects automatic detection capped at 8 workers, 1 stays on the caller thread, and 2..8 sets the worker upper bound. Missing, fractional, non-finite, negative, or above-8 values fail with kInvalidArgument.

setIterative(enabled, maxIterations, maxChange) stores iterative-calculation settings. getIterative() reads them back as { status, enabled, maxIterations, maxChange }; maxIterations is capped at 32767, and the getter reports that capped value.

setIterativeProgress(callback) and setLogSink(sink) accept a function or null; any other value returns kInvalidArgument (2) and keeps the installed callback. A Workbook method called from the iterative progress callback throws TypeError naming kGraphRecalcReentrant (4005) and changes nothing.

setCalcMode(mode) takes a CalcMode; with AutoNoTable, recalc() skips data-table results until recalcDataTables() runs. fullPrecision(), calcOnSave(), refMode(), and date1904() read the corresponding <calcPr> and <workbookPr> settings, and each has a setter. Other <calcPr> attributes are kept across a resave.

activeSheet() / setActiveSheet(sheet) read and write the active tab; setting it moves tabSelected and rejects a hidden sheet. Hiding or removing the active sheet activates the next visible sheet to the right, otherwise the nearest visible one on the left. setSheetTopLeft() and setSheetPaneTopLeft() set the scroll origin of the view and of the lower-right pane, and getSheetSelection() / setSheetSelection() address the selection of each pane. setSheetSplit(sheet, xTwips, yTwips) splits the view at a twips offset on either axis without freezing it; a split replaces a freeze and the other way round, and 0, 0 removes it. A selection in a pane the view lacks is dropped on save, and an active cell outside every selected range moves to the top-left of the first range. getSheetView() reports showFormulas and showOutlineSymbols, which have the setters setSheetShowFormulas() and setSheetShowOutlineSymbols().

setRowCollapsed() and setColumnCollapsed() set the outline collapsed flag that the row and column override getters report. outlineLevelRow and outlineLevelCol are derived from the deepest levels on every save. An outline level above 7 fails with kInvalidArgument.

addDataTable(sheet, spec), getDataTable(sheet, row, col), and removeDataTable(sheet, row, col) manage What-If data tables (<f t="dataTable">). recalc() fills one-variable (column or row input) and two-variable tables by substituting each value into the input cells, recalculating the cells that read them, and restoring the inputs. Writing into a result cell fails with kPreconditionFailed, as does a row or column insert or delete that cuts through the table or its header row and column. Result cells report =TABLE(row_input,col_input) through the formula getters, FORMULATEXT returns {=TABLE(...)}, and ISFORMULA is TRUE. addDataTable returns kDataTableInvalid (8005) when no input cell is given, an input lies inside the result range, or the range overlaps another table.

listShapes(), insertShape(), updateShape(), and removeShape() cover the xdr:sp shapes and text boxes, xdr:cxnSp connectors, and xdr:grpSp groups of a sheet's drawing. An update rewrites only the fields it names and keeps the rest of the shape's XML. A shape the record cannot express is listed with ShapePaint.Other or empty fields and passes through a save unchanged. Shapes follow row and column edits like pictures do.

listSparklineGroups(), addSparklineGroup(), updateSparklineGroup(), setSparklineGroupSparklines(), and removeSparklineGroup() manage the x14:sparklineGroups of a sheet. An update keeps attributes and children outside the record, such as rightToLeft, uid, and unknown extensions.

listSlicers(), addSlicer(sheet, table, column, spec), updateSlicer(), and removeSlicer() manage table slicers. Adding one creates the slicer part, its cache, the extension entries, the defined name, and the drawing frame. Removing a slicer also removes its cache once no other slicer uses it. Removing a table or a sheet, or deleting the rows or columns under a slicer's frame, removes the slicers bound to it. Slicers over a pivot cache pass through untouched and are not listed; the selection of a table slicer lives in the table's AutoFilter.

getWorkbookProtection() / setWorkbookProtection() read and write <workbookProtection>, and getProtectedRanges(), addProtectedRange(), updateProtectedRange(), and removeProtectedRange() manage a sheet's <protectedRange> entries; the ranges move with row and column edits. Password hashes are stored as the host computes them, and attributes the record does not model are kept. Neither protection is enforced on cell edits.

tableAt(idx) returns the table's style name and stripe toggles, its header and totals row counts, and each column's totals function. setTableColumnTotals(idx, column, totals) sets one column's totals function and label; while the totals row is shown, its cell is written to match. getTableStyle(), setTableStyle(), removeTableStyle(), getTableStyleDefaults(), and setTableStyleDefaults() manage custom <tableStyles> and the default table and PivotTable style names; pivotGetStyleInfo() / pivotSetStyleInfo() read and write a PivotTable's style. setDefinedNameAttrs(name, localSheetId, { comment, hidden }) sets a name's comment and hidden flag; an omitted key leaves that attribute unchanged, and replacing the name's formula keeps both.

getCommentVisible() / setCommentVisible() read and write whether a legacy note is shown. A note's box, its visibility, and the authors table of its comments part are kept across a resave, and a box follows its note through row and column edits. getCellShowPhonetic() / setCellShowPhonetic() read and write the per-cell Show Phonetic flag; saved files carry it on constants and blanks only, not on formula cells.

SheetVisibility has Visible = 0, Hidden = 1, and VeryHidden = 2. setSheetVisibility(sheet, visibility) writes the whole tab state, while getSheetView(sheet).view.visibility distinguishes the two hidden states. The legacy tabHidden flag remains 1 for both hidden states. setSheetTabHidden(true) does not demote a very-hidden sheet; use setSheetVisibility() for that transition.

addSheet() and renameSheet() fail with kInvalidSheetName for an empty name, a name over 31 UTF-16 units, one with : \ / ? * [ ], one that begins or ends with an apostrophe, and one that matches another sheet's name under case folding. Under the win-* profiles, the default included, History in any case is refused as well; mac-* profiles accept it. Hiding or removing the only visible sheet fails with kInvalidArgument. insertRows(), deleteRows(), insertCols(), and deleteCols() fail with kPreconditionFailed when they cut through a data table, a legacy array block, or a PivotTable, or would push one of them or a table past the grid edge.

Worksheet print settings are authored with setSheetPageSetup(), setSheetPageMargins(), setSheetPrintOptions(), setSheetHeaderFooter(), setSheetPrintArea(), setSheetPrintTitles(), addSheetRowBreak(), and addSheetColBreak(); raw XML setters are available for unmodeled fragments and validate input before storing it. Header/footer inputs use decoded Excel section strings, so a literal ampersand is written as &&.

setRangeXfIndex(sheet, firstRow, firstCol, lastRow, lastCol, xfIndex) applies one cell-style XF index across an inclusive rectangle and materializes missing cells as styled blanks.

Row and column styles, clearCellXfIndex() versus setCellXfIndex(..., 0), and the rangeStyleBases() → remapRangeStyle() attribute-only edit with its snapshotRangeStyle() / restoreRangeStyle() undo capture are described in Workbook operations. getEffectiveStyle().source reports whether a style came from the Cell, Row, Column, or Default.

setFormula() validates the complete formula before changing a cell. A malformed formula returns a failed status corresponding to kParserUnexpectedToken and leaves an existing formula, cached value, and dependency edges unchanged. A malformed formula already stored in an XLSX or XLSB file is kept as file text; after recalculation the cell yields the #NAME? error value. The ad-hoc evalFormula() path has different input semantics: malformed text still returns #NAME? as a cell value with a successful status.

getCellsInRange(sheet, range, cursor, limit) returns { status, cells, nextCursor } in row-major order. Each RangeCell has row, col, formula, and value. Omit cursor for the first page and pass back nextCursor until it is null; an omitted or zero limit uses the 65,536-cell maximum. Formula cells, non-blank values, and spill phantoms are included, while styled blanks are not. listInvalidCells() uses the same cursor and limit contract.

Geometry methods use GeometryMode.Display for the 96-DPI screen model and GeometryMode.Print for the DPI-stable pagination model. Display methods return DisplayStatus.Overflow with ######## when the value is outside the format's representable range, such as an invalid date serial, and DisplayStatus.InvalidFormat when the format code is malformed; the latter falls back to General rendering.

setCellStyle(record) adds or replaces a named cell style. The JavaScript record is { name, xfId?, builtinId?, iLevel?, hidden?, customBuiltin? }; omitted fields default to xfId: 0, a custom builtinId, level 0, and both flags false. The xfId points into the named-style cellStyleXfs table, not the per-cell cellXfs table.

getTheme() returns the four theme typefaces plus majorScripts and minorScripts; setThemeScriptFont(major, script, typeface) changes or appends one script entry. The defaults and the Jpan fallback rule are in Presentation and geometry.

dataBar.direction in conditional-format records uses 0 for context, 1 for left-to-right, and 2 for right-to-left, and resolved matches report it as CfMatch.barDirection. iconSet.floor is the lower-bound CfValueObjectInput: optional when adding a rule and present on every icon-set rule read back.

pivotFieldAddItemAt(sheet, pivotIdx, fieldIdx, cacheIndex, visible) addresses a manual-filter item by its bound cache field's shared-item index. It is the only form that can identify a blank pivot member; an empty name passed to pivotFieldAddItem() is text matching and cannot do so. An unresolved index is accepted but filters nothing.

Data-validation input defaults allowBlank to false when omitted. Pass allowBlank: true to allow empty cells; showDropDown remains the OOXML-inverted exception.

AutoFilter criteria are stored separately from row visibility. Use evaluateAutoFilter() to inspect matches and applyAutoFilter() to update hidden rows; clearAutoFilter() removes criteria while retaining the AutoFilter range. Validation methods check proposed values without storing them, and listInvalidCells() enumerates existing violations.

probeImage() reads PNG, JPEG, GIF, or BMP dimensions without touching the workbook. listDrawingObjects() returns anchored objects in document order; getImage() copies picture bytes, insertImage() preserves existing drawing content, and removeDrawing() removes a picture or chart and releases its media when no other object references it. Chart methods are described in Charts. Threaded-comment methods include replies and person records; removing a person fails while a comment or mention still refers to that person.

paginate(sheet) returns the resolved print layout in one result: printArea, horizontalBreaks, verticalBreaks, pageCount, paper, margins, printable, scale, pageOrder, printTitles, pages, horizontalBreakManual, and verticalBreakManual, together with status. paper reports point dimensions, orientation, and whether the stored paper code was known. pages lists physical pages in print order with areaIndex, inclusive cell bounds, origin, and scaled size. A missing declared print area leaves printArea empty while pagination falls back to the used range; the manual-break arrays parallel their break arrays.

evaluateFormulaText and evaluateConditionalFormula evaluate formula text against an existing workbook without mutating it or joining the dependency graph. They resolve local and cross-sheet references, defined names, and ROW() / COLUMN() anchoring; conditional-format evaluation also shifts relative references from the rule anchor and applies Excel-style predicate coercion. An array/spill result from the scalar call is reduced to its top-left element (not Excel implicit intersection). A formula that references its own anchor cell reads that cell's cached value rather than raising #REF!.

evaluateFormulaArray is the whole-array companion to evaluateFormulaText. It shares the same read-only resolution and never joins the dependency graph, but returns the entire result as an EvalArrayResult (status, rows, cols, and row-major cells: Value[][]; a scalar is a 1×1 array). Range-shaped defined names evaluate as Array values and spill-phantom cells are enumerated by cellCount / cellAt.

The diagram below contrasts three paths through the same workbook:

01setFormula()writes the formula into thecell02recalc()joins the graph; dependentsrecompute01setFormula()writes the formula into the cell02recalc()joins the graph; dependents recompute
Only the mutate path writes to the workbook and joins the dependency graph.
01evaluateFormulaText()read-only; refs, names, ROW()/COLUMN()02Scalar EvalResultarray → top-left · self-ref → cached01evaluateFormulaText()read-only; refs, names, ROW()/COLUMN()02Scalar EvalResultarray → top-left · self-ref → cached
The scalar call reduces an array to its top-left element: =SEQUENCE(3) returns 1, not three rows.
01evaluateFormulaArray()same read-only resolution02EvalArrayResultrows × cols cells[][];scalar is 1×101evaluateFormulaArray()same read-only resolution02EvalArrayResultrows × cols cells[][]; scalar is 1×1
The array call returns the whole result and never reduces it; a scalar comes back as a 1×1 array.