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
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.
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
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:
| Area | Enums |
|---|---|
| Values | ValueKind, ErrorCode (Null = 0, Div0 = 1, … Python = 15, Unknown = 16; the ordinal in Value.errorCode and the argument of setError) |
| Geometry and display | GeometryMode (Display = 0, Print = 1), DisplayStatus (Ok = 0, Overflow = 1, InvalidFormat = 2) |
| AutoFilter | FilterKind, FilterOperator, DynamicFilterType, SortBy, SortMethod, DateTimeGrouping |
| Validation | ValidationErrorStyle (Stop = 0, Warning = 1, Information = 2) |
| Conditional formats | CfMatchKind (DifferentialFormat = 0, ColorScale = 1, DataBar = 2, IconSet = 3) |
| Themes and styles | ColorContext, ColorResolution, ThemeSource, EffectiveStyleSource |
| Images and drawings | ImageFormat, DrawingObjectKind, AnchorKind, AnchorEditAs |
| PivotTables | PivotAxis, PivotAggregation, PivotShowValuesAs, PivotFilterType, PivotFilterValueKind, PivotDateGrouping, PivotCalendar, PivotReportLayout, PivotCellKind, plus the constants PIVOT_SHOW_AS_BASE_PREVIOUS / PIVOT_SHOW_AS_BASE_NEXT |
| Text collation | CollationStrength (Compare = 0, Dynamic = 1, ClassicExact = 2) |
| Workbook state | CalcMode (round-trip metadata only; the engine recalculates dirty cells in every mode), SheetVisibility, WorkbookFormat, ExternalLinkKind |
| Logging | LogLevel (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
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:
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.
| Result | Fields | Meaning |
|---|---|---|
saveWithDiagnostics | downgradedFormulaCount | Formula cells emitted as cached literals; always zero for XLSX. |
deferredFeatureCount | Sheet features not lowered to records; always zero for XLSX. | |
droppedPartCount | Passthrough parts dropped by either writer. | |
droppedRelationshipCount | Relationships dropped because their target part was dropped; this can describe the same loss as droppedPartCount. | |
renumberedPartCount | Tables emitted under a writer-assigned part id; always zero for XLSB. | |
readDiagnostics | undecodedFormulaCount | Stored formulas that could not be decoded; XLSB only. |
undecodedDefinedNameCount | Defined names skipped because they could not be decoded; XLSB only. | |
undecodedPartCount | XLSB package parts whose content type could not be resolved. | |
skippedFeatureCount | OOXML presentation-overlay entries skipped because their references were unusable. | |
unknownContentTypeCount | OOXML 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:
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.
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
| Name | Signature | Description |
|---|---|---|
createFormulon | createFormulon(opts?: FormulonModuleOptions): Promise<FormulonModule> | Default export from formulon.js: the Emscripten module factory. |
Module.versionString | versionString(): string | Library version string (UTF-8). |
Module.version | version(): string | Alias of versionString, matching the Node binding's name. |
Module.statusString | statusString(status: number): string | Static description of status (e.g. "kOk"). |
Module.errorDisplayName | errorDisplayName(errorCode: number): string | Excel display literal for a cell error code (e.g. "#DIV/0!"). |
Module.lastErrorMessage | lastErrorMessage(): string | Most-recent thread-local error message. |
Module.lastErrorContext | lastErrorContext(): string | Most-recent thread-local error context. |
Module.setLogMinLevel | setLogMinLevel(level: number): Status | Sets the engine's minimum structured-log severity (a LogLevel ordinal). |
Module.setLogSink | setLogSink(sink: ((record: Uint8Array) => void) | null): Status | Routes structured-log records to sink, or restores the (silent at the default threshold) stderr fallback when sink is null. |
Workbook lifecycle and I/O
| Name | Signature | Description |
|---|---|---|
Workbook.createDefault | createDefault(): Workbook | Workbook with a single default sheet ("Sheet1"). |
Workbook.createEmpty | createEmpty(): Workbook | Workbook with no sheets. |
Workbook.createForProfile | createForProfile(profileId: string): Workbook | Workbook 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.loadBytes | loadBytes(bytes: Uint8Array): Workbook | Loads from an in-memory workbook byte buffer, auto-detecting .xlsx vs .xlsb from the package contents (there is no filename to route on). |
isValid | isValid(): boolean | True when the wrapper holds a live native handle. |
delete | delete(): void | Releases the native handle. |
save | save(): SaveResult | Serialises the workbook to an in-memory .xlsx byte stream. |
saveAs | saveAs(format: WorkbookFormat | number): SaveResult | Serialises using an explicit container format (see WorkbookFormat). |
saveWithDiagnostics | saveWithDiagnostics(format: WorkbookFormat | number): SaveDiagnosticsResult | Serialises using an explicit format and reports loss/defer counters. |
readDiagnostics | readDiagnostics(): ReadDiagnosticsResult | Returns the loss counters captured when this handle was loaded. |
passthroughCount | passthroughCount(): NumberResult | Number of OOXML parts the reader carried through unchanged. |
passthroughAt | passthroughAt(idx: number): PassthroughEntry | Reads the path of the idx-th passthrough part; kInvalidArgument when idx is out of range. |
Sheets and structure
| Name | Signature | Description |
|---|---|---|
addSheet | addSheet(name: string): Status | Appends a sheet. |
removeSheet | removeSheet(index: number): Status | Removes the sheet at index. |
renameSheet | renameSheet(index: number, newName: string): Status | Renames the sheet at index. |
moveSheet | moveSheet(fromIdx: number, toIdx: number): Status | Moves the sheet from fromIdx to toIdx (post-removal index). |
sheetCount | sheetCount(): NumberResult | Number of sheets. |
sheetName | sheetName(idx: number): StringResult | Display name of the sheet at idx; kInvalidArgument when idx is out of range. |
activeSheet | activeSheet(): AddStyleResult | Returns { 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. |
setActiveSheet | setActiveSheet(sheet: number): Status | Marks sheet sheet active so a save records it, creating a minimal <bookViews> when the workbook has none. |
insertRows | insertRows(sheet: number, row: number, count: number): Status | Inserts count rows at row on sheet and rewrites cross-workbook references to follow the shift. |
deleteRows | deleteRows(sheet: number, row: number, count: number): Status | Deletes count rows starting at row on sheet. |
insertCols | insertCols(sheet: number, col: number, count: number): Status | Inserts count columns at col on sheet. |
deleteCols | deleteCols(sheet: number, col: number, count: number): Status | Deletes count columns starting at col on sheet. |
Cells
| Name | Signature | Description |
|---|---|---|
setNumber | setNumber(sheet: number, row: number, col: number, value: number): Status | Stores a numeric literal. |
setBool | setBool(sheet: number, row: number, col: number, value: boolean): Status | Stores a boolean literal. |
setError | setError(sheet: number, row: number, col: number, errorCode: number): Status | Stores a static Excel error literal; errorCode is an ErrorCode ordinal. |
setText | setText(sheet: number, row: number, col: number, text: string): Status | Stores a text literal. |
setCellPhonetic | setCellPhonetic(sheet: number, row: number, col: number, phonetic: string): Status | Stores (or, when empty, clears) the cell's OOXML phonetic guide (<rPh>). |
setCellPhoneticRuns | setCellPhoneticRuns(sheet: number, row: number, col: number, runs: PhoneticRun[]): Status | Stores (or, when empty, clears) the cell's phonetic guide as one <rPh> block per run. |
setCellPhoneticProperties | setCellPhoneticProperties(sheet: number, row: number, col: number, properties: PhoneticProperties): Status | Stores how the cell's guide renders. |
setBlank | setBlank(sheet: number, row: number, col: number): Status | Stores a blank literal at the cell; equivalent to clearing it. |
setFormula | setFormula(sheet: number, row: number, col: number, formula: string): Status | Stores a formula. |
getValue | getValue(sheet: number, row: number, col: number): CellResult | Reads the cell's cached value, as of the most recent recalc; call recalc first after mutating cells. |
getFormula | getFormula(sheet: number, row: number, col: number): FormulaResult | The stored A1 formula (leading = included), or formula: null for a cell that holds none. |
getFormulaR1C1 | getFormulaR1C1(sheet: number, row: number, col: number): FormulaResult | The formula in R1C1 notation relative to the cell, without a leading =; formula: null when the cell holds none. |
getCellsInRange | getCellsInRange(sheet: number, range: MergeRange, cursor?: number | null, limit?: number | null): CellsInRangeResult | One page of the populated cells (formula or non-blank value, spill phantoms included) inside range, row-major. |
getLambdaText | getLambdaText(sheet: number, row: number, col: number): LambdaTextResult | Renders the lambda value stored at (sheet, row, col) as Excel formula text. |
getCellPhonetic | getCellPhonetic(sheet: number, row: number, col: number): StringResult | Returns the cell's OOXML phonetic guide (<rPh>), or an empty string. |
getCellPhoneticRuns | getCellPhoneticRuns(sheet: number, row: number, col: number): PhoneticRunsResult | Returns the cell's <rPh> blocks with their spans. |
getCellPhoneticProperties | getCellPhoneticProperties(sheet: number, row: number, col: number): PhoneticPropertiesResult | Returns how the cell's guide renders. |
cellCount | cellCount(sheet: number): NumberResult | Number 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. |
cellAt | cellAt(sheet: number, idx: number): CellEntry | Reads the idx-th counted coordinate, idx in [0, cellCount), ordered by (row, col) ascending. |
Recalculation
| Name | Signature | Description |
|---|---|---|
recalc | recalc(): Status | Recalculates all dirty cells serially on the caller thread. |
recalcParallel | recalcParallel(threadCount: number): ParallelRecalcResult | Recalculates all dirty cells using the parallel SCC scheduler and returns per-call telemetry. |
partialRecalc | partialRecalc(viewport: RecalcViewport): PartialRecalcResult | Recalculates only cells touched by the supplied viewport. |
setIterative | setIterative(enabled: boolean, maxIterations: number, maxChange: number): Status | Sets iterative calculation. |
getIterative | getIterative(): IterativeSettingsResult | Reads back the stored iterative-calculation settings. |
setIterativeProgress | setIterativeProgress(callback: IterativeProgressCallback | null): Status | Installs (or, when passed null, clears) a JS callback invoked after each Gauss-Seidel sweep. |
calcMode | calcMode(): NumberResult<CalcMode> | Workbook-level calc mode (Excel <calcPr calcMode> policy). |
setCalcMode | setCalcMode(mode: CalcMode): Status | Sets the calc mode; only AutoNoTable changes evaluation (recalc() skips the data tables). |
fullPrecision | fullPrecision(): NumberResult | <calcPr fullPrecision> as 0/1; 0 is "set precision as displayed". |
setFullPrecision | setFullPrecision(fullPrecision: boolean): Status | |
calcOnSave | calcOnSave(): NumberResult | <calcPr calcOnSave> as 0/1 (default 1). |
setCalcOnSave | setCalcOnSave(calcOnSave: boolean): Status | |
refMode | refMode(): NumberResult<RefMode> | <calcPr refMode> as a RefMode code. |
setRefMode | setRefMode(mode: RefMode): Status | Returns kInvalidArgument for a value outside RefMode. |
date1904 | date1904(): NumberResult | The 1904 date system flag (<workbookPr date1904>) as 0/1. |
setDate1904 | setDate1904(date1904: boolean): Status | Switches the date system without converting stored serials, so every date shifts by 1462 days. |
pinnedNow | pinnedNow(): PinnedNowResult | The workbook's pinned wall-clock reading as now, or now: null when it follows the host clock (the default). |
setPinnedNow | setPinnedNow(year: number, month: number, day: number, hour: number, minute: number, second: number): Status | Pins the workbook clock to a local civil instant; see pinnedNow for the accepted ranges. |
clearPinnedNow | clearPinnedNow(): Status | Releases the pin so the clock follows the host again. |
addDataTable | addDataTable(sheet: number, spec: DataTableSpec): Status | Creates a data table over spec's result range. |
getDataTable | getDataTable(sheet: number, row: number, col: number): DataTableResult | Reads the data table whose result range contains (row, col). |
removeDataTable | removeDataTable(sheet: number, row: number, col: number): Status | Removes the data table containing (row, col) and blanks its result cells. |
recalcDataTables | recalcDataTables(): Status | Recomputes every data table now, whatever the calc mode. |
Read-only evaluation
| Name | Signature | Description |
|---|---|---|
Module.evalFormula | evalFormula(formula: string): EvalResult | Convenience: evaluates formula read-only against a fresh single-sheet workbook, anchored at Sheet1!A1. |
evaluateFormulaText | evaluateFormulaText(sheet: number, row: number, col: number, formula: string): EvalResult | Evaluates formula as if entered at (sheet, row, col) and returns a single scalar result, without mutating the workbook. |
evaluateFormulaArray | evaluateFormulaArray(sheet: number, row: number, col: number, formula: string): EvalArrayResult | Evaluates formula as if entered at (sheet, row, col) and returns the whole multi-cell result without mutating the workbook. |
evaluateConditionalFormula | evaluateConditionalFormula(sheet: number, row: number, col: number, anchorRow: number, anchorCol: number, formula: string): EvalResult | Evaluates 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
| Name | Signature | Description |
|---|---|---|
mergeFunctionMetadata | mergeFunctionMetadata(base: FunctionMetadataResult, entry: FunctionMetadataEntry | undefined, locale: string): MergedFunctionMetadataResult | Merges a host-supplied FunctionMetadataEntry over the engine's structural functionMetadata() result. |
excelProfileId | excelProfileId(): StringResult<ExcelProfileId> | Full formula-behaviour profile id. |
setExcelProfileId | setExcelProfileId(profileId: ExcelProfileId): Status | Selects the formula-behaviour profile; kInvalidArgument for an id that is not an ExcelProfileId. |
functionMetadata | functionMetadata(name: string): FunctionMetadataResult | Returns metadata for the function name (case-insensitive). |
functionNames | functionNames(): ListResult<string> | Returns every registered function's canonical name in ascending sort order. |
localizeFunctionName | localizeFunctionName(canonicalName: string, profileId: ExcelProfileId): StringResult | Returns the localized display name for the canonical function canonicalName under profileId. |
canonicalizeFunctionName | canonicalizeFunctionName(localizedName: string, profileId: ExcelProfileId): StringResult | Inverse of localizeFunctionName: returns the canonical English name for the localized function localizedName under profileId. |
localizeFormula | localizeFormula(formula: string, profileId: ExcelProfileId): StringResult | Rewrites stored (en-invariant) formula text into profileId's Excel spelling: function names, list / array separators, decimal points, booleans and error names. |
canonicalizeFormula | canonicalizeFormula(formula: string, profileId: ExcelProfileId): StringResult | Inverse of localizeFormula: rewrites profileId-spelled formula text into the en-invariant form. |
localeFacts | localeFacts(profileId: ExcelProfileId): LocaleFactsResult | Returns the locale facts (separators, boolean names, date order, currency, error names) of profileId. |
compareText | compareText(a: string, b: string, strength: CollationStrength, profileId: ExcelProfileId): CompareTextResult | Compares two texts under profileId and returns the sign of the result in order. |
collationClasses | collationClasses(values: Value[], strength: CollationStrength, profileId: ExcelProfileId): CollationClassesResult | Classifies values into collation-ordered equivalence classes under profileId. |
Defined names
| Name | Signature | Description |
|---|---|---|
definedNameCount | definedNameCount(): NumberResult | Number of defined names, workbook- and sheet-scoped alike. |
definedNameAt | definedNameAt(idx: number): DefinedNameEntry | Reads the idx-th defined name with its scope; kInvalidArgument when idx is out of range. |
setDefinedName | setDefinedName(name: string, formula: string): Status | Adds, replaces, or (when formula is empty) removes a workbook- scoped defined name. |
setDefinedNameScoped | setDefinedNameScoped(name: string, formula: string, localSheetId: number): Status | Adds, replaces, or removes a defined name in workbook scope (-1) or a sheet-local scope (0-based sheet index). |
setDefinedNameAttrs | setDefinedNameAttrs(name: string, localSheetId: number, attrs: { comment?: string; hidden?: boolean }): Status | Sets the comment and / or hidden of an existing defined name in the given scope; an omitted key leaves that attribute unchanged. |
Tables
| Name | Signature | Description |
|---|---|---|
tableCount | tableCount(): NumberResult | Number of worksheet tables in the workbook. |
tableAt | tableAt(idx: number): TableEntry | Reads the idx-th table's identifying metadata; kInvalidArgument when idx is out of range. |
createTable | createTable(input: TableInput): AddStyleResult | Creates a worksheet table; index of the result is its workbook-wide table index (see tableAt). |
updateTable | updateTable(idx: number, input: TableUpdateInput): Status | Partially updates a table. |
removeTable | removeTable(idx: number): Status | Removes the table at idx. |
tableStyleCount | tableStyleCount(): NumberResult | Number of custom table / PivotTable styles (<tableStyles>). |
getTableStyle | getTableStyle(index: number): TableStyleResult | Reads the custom table style at index. |
setTableStyle | setTableStyle(style: TableStyle): Status | Adds a custom table style, or replaces the one with the same name (case-insensitive). |
removeTableStyle | removeTableStyle(name: string): Status | Removes the custom table style name. |
getTableStyleDefaults | getTableStyleDefaults(): TableStyleDefaultsResult | Reads the default table and PivotTable style names. |
setTableStyleDefaults | setTableStyleDefaults(defaults: { tableStyle?: string; pivotStyle?: string }): Status | Sets the default style names; an omitted field keeps its default and an empty string removes it. |
Dependencies, spills and external links
| Name | Signature | Description |
|---|---|---|
getExternalLinks | getExternalLinks(): ListResult<ExternalLinkRecord> | Returns every external-link record carried by the workbook in <externalReferences> document order. |
precedents | precedents(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. |
dependents | dependents(sheet: number, row: number, col: number, depth: number): ListResult<CellNode> | Returns the cells that read (sheet, row, col) directly (1-step dependents). |
spillInfo | spillInfo(sheet: number, row: number, col: number): SpillInfo | Returns dynamic-array spill info for (sheet, row, col). |
Sheet view and protection
| Name | Signature | Description |
|---|---|---|
getCellShowPhonetic | getCellShowPhonetic(sheet: number, row: number, col: number): CellShowPhoneticResult | Reads the cell's "Show Phonetic" flag (<c ph="1">); false for an absent cell. |
setCellShowPhonetic | setCellShowPhonetic(sheet: number, row: number, col: number, show: boolean): Status | Sets the cell's "Show Phonetic" display flag. |
getSheetView | getSheetView(sheet: number): SheetViewResult | Reads the full per-sheet view (zoom, freeze, tab-hidden, and the display / orientation flags). |
setSheetZoom | setSheetZoom(sheet: number, zoomScale: number): Status | Sets the sheet zoom percentage (clamped to [10, 400]). |
setSheetFreeze | setSheetFreeze(sheet: number, freezeRows: number, freezeCols: number): Status | Sets the frozen pane in (rows, cols). |
setSheetTabHidden | setSheetTabHidden(sheet: number, hidden: boolean): Status | Sets the sheet tab's hidden flag — the two-state view of setSheetVisibility. |
setSheetVisibility | setSheetVisibility(sheet: number, visibility: SheetVisibility): Status | Sets the sheet tab's visibility to one of the three states. |
setSheetShowGridLines | setSheetShowGridLines(sheet: number, show: boolean): Status | Sets the sheet's showGridLines flag. |
setSheetShowRowColHeaders | setSheetShowRowColHeaders(sheet: number, show: boolean): Status | Sets the sheet's showRowColHeaders flag. |
setSheetShowZeros | setSheetShowZeros(sheet: number, show: boolean): Status | Sets the sheet's showZeros flag. |
setSheetShowFormulas | setSheetShowFormulas(sheet: number, show: boolean): Status | Sets the sheet's showFormulas flag. |
setSheetShowOutlineSymbols | setSheetShowOutlineSymbols(sheet: number, show: boolean): Status | Sets the sheet's showOutlineSymbols flag. |
setSheetRightToLeft | setSheetRightToLeft(sheet: number, rightToLeft: boolean): Status | Sets the sheet's rightToLeft flag. |
setSheetTabSelected | setSheetTabSelected(sheet: number, selected: boolean): Status | Sets the sheet's tabSelected flag. |
setSheetTopLeft | setSheetTopLeft(sheet: number, row: number, col: number): Status | Sets the sheet view's scroll origin (<sheetView topLeftCell>). |
setSheetPaneTopLeft | setSheetPaneTopLeft(sheet: number, row: number, col: number): Status | Sets the first visible cell of a frozen or split view's lower-right pane. |
setSheetSplit | setSheetSplit(sheet: number, xTwips: number, yTwips: number): Status | Splits the view at xTwips / yTwips (0 for none on that axis; 0, 0 removes the split). |
getSheetSelection | getSheetSelection(sheet: number): SheetSelectionResult | Reads the active pane's selection (active cell and ranges). |
setSheetSelection | setSheetSelection(sheet: number, selection: SheetSelection): Status | Replaces the active pane's selection. |
setSheetViewMode | setSheetViewMode(sheet: number, mode: string): Status | Sets the sheet's <sheetView view="..."> mode: "", "pageBreakPreview", or "pageLayout". |
getSheetProtection | getSheetProtection(sheet: number): SheetProtectionResult | Reads the sheet's <sheetProtection> flags. |
setSheetProtection | setSheetProtection(sheet: number, protection: SheetProtection): Status | Replaces the sheet's <sheetProtection> flags wholesale. |
getWorkbookProtection | getWorkbookProtection(): WorkbookProtectionResult | Reads the workbook's <workbookProtection>; every field is zero or empty when absent. |
setWorkbookProtection | setWorkbookProtection(protection: WorkbookProtection): Status | Replaces the modelled <workbookProtection> attributes. |
getProtectedRanges | getProtectedRanges(sheet: number): ListResult<ProtectedRange> | Returns the protected ranges of sheet in file order. |
addProtectedRange | addProtectedRange(sheet: number, range: ProtectedRange): Status | Appends a protected range. |
updateProtectedRange | updateProtectedRange(sheet: number, index: number, range: ProtectedRange): Status | Replaces protected range index. |
removeProtectedRange | removeProtectedRange(sheet: number, index: number): Status | Removes protected range index. |
Rows, columns and geometry
| Name | Signature | Description |
|---|---|---|
setTableColumnTotals | setTableColumnTotals(idx: number, column: number, totals: TableColumnTotalsInput): Status | Sets column column's totals-row function and label. |
getSheetColumns | getSheetColumns(sheet: number): ColumnsResult | Returns the column-layout overrides on sheet in storage order. |
setColumnWidth | setColumnWidth(sheet: number, first: number, last: number, width: number): Status | Sets / replaces the column width override on [first, last]. |
setColumnHidden | setColumnHidden(sheet: number, first: number, last: number, hidden: boolean): Status | Sets / replaces the column hidden flag on [first, last]. |
setColumnOutline | setColumnOutline(sheet: number, first: number, last: number, level: number): Status | Sets / replaces the column outline level on [first, last]. |
setColumnCollapsed | setColumnCollapsed(sheet: number, first: number, last: number, collapsed: boolean): Status | Sets / clears the column collapsed flag on [first, last]. |
setColumnStyle | setColumnStyle(sheet: number, first: number, last: number, xfIndex: number): Status | Sets / replaces the cell-style XF on [first, last]; index 0 is the default XF. |
clearColumnStyle | clearColumnStyle(sheet: number, first: number, last: number): Status | Removes the cell-style XF on [first, last], retaining other column attributes. |
getSheetRowOverrides | getSheetRowOverrides(sheet: number): RowsResult | Returns the row-layout overrides on sheet. |
setRowHeight | setRowHeight(sheet: number, row: number, height: number): Status | Sets / replaces the row height override at row. |
setRowHidden | setRowHidden(sheet: number, row: number, hidden: boolean): Status | Sets / replaces the row hidden flag at row. |
setRowOutline | setRowOutline(sheet: number, row: number, level: number): Status | Sets / replaces the row outline level at row. |
setRowCollapsed | setRowCollapsed(sheet: number, row: number, collapsed: boolean): Status | Sets / clears the row collapsed flag at row. |
setRowStyle | setRowStyle(sheet: number, first: number, last: number, xfIndex: number): Status | Sets / replaces the cell-style XF of the inclusive row span first..last; index 0 is the default XF. |
clearRowStyle | clearRowStyle(sheet: number, first: number, last: number): Status | Removes the cell-style XF of the inclusive row span first..last, retaining other row attributes. |
clearRowHeight | clearRowHeight(sheet: number, row: number): Status | Removes the height override at row, returning it to the sheet default. |
clearColumnWidth | clearColumnWidth(sheet: number, first: number, last: number): Status | Removes the width override on columns first..last, returning them to the sheet default width. |
getSheetFormatDefaults | getSheetFormatDefaults(sheet: number): SheetFormatDefaultsResult | Reads the sheet's default column / row metrics. |
setSheetFormatDefaults | setSheetFormatDefaults(sheet: number, defaults: Partial<SheetFormatDefaults>): Status | Replaces the sheet's default column / row metrics. |
getCellRectPt | getCellRectPt(sheet: number, range: MergeRange, mode: GeometryMode): CellRectResult | Rectangle covering the inclusive cell range, in points from the top-left of A1. |
getColumnWidthPt | getColumnWidthPt(sheet: number, col: number, mode: GeometryMode): NumberResult | Effective column width in points; zero when hidden. |
getRowHeightPt | getRowHeightPt(sheet: number, row: number): NumberResult | Effective row height in points; zero when hidden. |
getWidthModel | getWidthModel(sheet: number, mode: GeometryMode): WidthModelResult | The character-unit to point conversion model for the workbook's Normal font. |
columnCharsToPt | columnCharsToPt(sheet: number, mode: GeometryMode, chars: number): NumberResult | Converts a stored column width (padding included) to points, snapped to whole screen pixels. |
columnPtToChars | columnPtToChars(sheet: number, mode: GeometryMode, pt: number): NumberResult | Inverse of columnCharsToPt: the stored width Excel writes for a column of pt. |
Display text
| Name | Signature | Description |
|---|---|---|
getDisplayText | getDisplayText(sheet: number, row: number, col: number): DisplayTextResult | The text Excel displays for the cell, from its value and number format under the workbook's date system. |
formatValue | formatValue(value: Value, formatCode: string): DisplayTextResult | Renders value (blank, number, boolean, text or error) under the stored-form number format formatCode; empty means General. |
Styles
| Name | Signature | Description |
|---|---|---|
rangeStyleBases | rangeStyleBases(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number): RangeStyleBasesResult | Lists, 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. |
remapRangeStyle | remapRangeStyle(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number, fromXfs: number[], toXfs: number[]): Status | Second 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. |
snapshotRangeStyle | snapshotRangeStyle(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number): RangeStyleSnapshotResult | Captures 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. |
restoreRangeStyle | restoreRangeStyle(sheet: number, bytes: Uint8Array): Status | Puts a snapshotRangeStyle capture back exactly. |
getCellXfIndex | getCellXfIndex(sheet: number, row: number, col: number): CellXfIndexResult | Returns { status, xfIndex } for the cell at (sheet, row, col). |
setCellXfIndex | setCellXfIndex(sheet: number, row: number, col: number, xfIndex: number): Status | Persists xfIndex on the cell at (sheet, row, col). |
clearCellXfIndex | clearCellXfIndex(sheet: number, row: number, col: number): Status | Removes the direct style assignment from the cell at (sheet, row, col) so a blank cell inherits its row / column style again. |
setRangeXfIndex | setRangeXfIndex(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number, xfIndex: number): Status | Applies xfIndex across an inclusive rectangle, materialising blank cells so an empty ruled box renders. |
getCellXf | getCellXf(xfIndex: number): CellXfResult | Returns the resolved XF record at xfIndex. |
getFont | getFont(fontIndex: number): FontResult | Returns the font record at fontIndex, including its ColorSpec selector. |
getFill | getFill(fillIndex: number): FillResult | Returns the fill record at fillIndex, including its ColorSpec selectors. |
getBorder | getBorder(borderIndex: number): BorderResult | Returns the border record at borderIndex, including its ColorSpec selectors. |
getNumFmt | getNumFmt(numFmtId: number): NumFmtResult | Returns the format string registered for numFmtId. |
getDxf | getDxf(dxfIndex: number): DxfResult | Returns the differential-format record referenced by CF dxfId. |
addFont | addFont(record: FontRecord): AddStyleResult | Adds a font (deduplicating against existing entries) and returns the resolved index. |
setFont | setFont(fontIndex: number, record: FontRecord): Status | Overwrites the font at fontIndex in place. |
setDefaultFont | setDefaultFont(record: FontRecord): Status | Declares the workbook's default font: font 0, the record an unstyled cell resolves to. |
addFill | addFill(record: FillRecord): AddStyleResult | Adds a fill (deduplicating against existing entries). |
addBorder | addBorder(record: BorderRecord): AddStyleResult | Adds a border (deduplicating against existing entries). |
addNumFmt | addNumFmt(formatCode: string): AddNumFmtResult | Adds a number-format code. |
addXf | addXf(record: CellXf): AddStyleResult | Adds an <xf> record (deduplicating against existing entries). |
addDxf | addDxf(record: DxfRecord): AddStyleResult | Adds a <dxf> differential-format record for conditional formats. |
fontCount | fontCount(): NumberResult | Returns the number of font records currently registered. |
fillCount | fillCount(): NumberResult | Returns the number of fill records currently registered. |
borderCount | borderCount(): NumberResult | Returns the number of border records currently registered. |
xfCount | xfCount(): NumberResult | Returns the number of <xf> records currently registered. |
dxfCount | dxfCount(): NumberResult | Returns the number of <dxf> records available for CF dxfId. |
cellStyleCount | cellStyleCount(): NumberResult | Returns the number of named cell styles (<cellStyle> entries) registered. |
cellStyleXfCount | cellStyleXfCount(): NumberResult | Returns the number of <cellStyleXfs> records — the named-style xf table referenced by CellStyleResult.xfId. |
getCellStyle | getCellStyle(index: number): CellStyleResult | Returns the named cell style at index. |
getCellStyleXf | getCellStyleXf(index: number): CellXfResult | Returns the named-style xf record at index. |
addCellStyleXf | addCellStyleXf(record: CellXf): AddStyleResult | Appends (deduplicating) a named-style xf and returns its <cellStyleXfs> index, which is what setCellStyle and CellXf.xfId reference. |
setCellStyle | setCellStyle(record: CellStyleRecord): Status | Adds or replaces the <cellStyle> entry named record.name. |
removeCellStyle | removeCellStyle(name: string): Status | Removes the <cellStyle> named name; cell formats that used it are repointed at the Normal style. |
getEffectiveStyle | getEffectiveStyle(sheet: number, row: number, col: number): EffectiveStyleResult | The formatting a cell shows: the xf chosen from cell, row, column or the default, with its colours resolved. |
Themes and colors
| Name | Signature | Description |
|---|---|---|
getTheme | getTheme(): ThemeResult | The 12 theme colours (clrScheme order) and the theme typefaces. |
setThemeColors | setThemeColors(colors: number[]): Status | Rewrites the 12 scheme colours (clrScheme order, alpha ignored). |
setThemeFonts | setThemeFonts(fonts: ThemeFonts): Status | Rewrites the theme's major and minor typefaces. |
setThemeScriptFont | setThemeScriptFont(major: boolean, script: string, typeface: string): Status | Sets one script's typeface in the major (major true) or minor font set; other scripts are unchanged and an unknown script is appended. |
resetTheme | resetTheme(): Status | Removes the theme part so the workbook reports the default theme (source is Default). |
resolveColor | resolveColor(spec: ColorSpec, context: ColorContext): ResolvedColorResult | Resolves a colour specification to ARGB against the theme and the indexed palette; context decides what an automatic colour means. |
Merges
| Name | Signature | Description |
|---|---|---|
addMerge | addMerge(sheet: number, range: MergeRange): Status | Adds a merge range to sheet. |
removeMerge | removeMerge(sheet: number, range: MergeRange): Status | Removes every merge that overlaps range (inclusive). |
removeMergeAt | removeMergeAt(sheet: number, index: number): Status | Removes the merge at index. |
clearMerges | clearMerges(sheet: number): Status | Drops every merge on sheet. |
getMerges | getMerges(sheet: number): ListResult<MergeRange> | Returns every merge range on sheet as a JS array. |
getMergesInRange | getMergesInRange(sheet: number, range: MergeRange): ListResult<MergeRange> | Returns the merge ranges on sheet that intersect range, in storage order. |
Comments and hyperlinks
| Name | Signature | Description |
|---|---|---|
getComment | getComment(sheet: number, row: number, col: number): CommentEntry | null | Returns the cell comment at (sheet, row, col), or null when absent. |
getCommentResult | getCommentResult(sheet: number, row: number, col: number): CommentResult | Returns a comment lookup result that distinguishes absence from an invalid sheet or handle. |
getComments | getComments(sheet: number): ListResult<SheetCommentEntry> | Returns every comment on sheet, including comments anchored on cells that carry no value. |
setComment | setComment(sheet: number, row: number, col: number, author: string, text: string): Status | Sets / replaces the cell comment. |
getCommentVisible | getCommentVisible(sheet: number, row: number, col: number): NumberResult | Whether the note at (sheet, row, col) is shown without hovering (value 0 or 1). |
setCommentVisible | setCommentVisible(sheet: number, row: number, col: number, visible: boolean): Status | Shows or hides the note at (sheet, row, col); its box geometry is kept. |
addHyperlink | addHyperlink(sheet: number, row: number, col: number, target: string, display: string, tooltip: string, location: string): Status | Appends a hyperlink to sheet. |
addHyperlinkRange | addHyperlinkRange(sheet: number, row: number, col: number, lastRow: number, lastCol: number, target: string, display: string, tooltip: string, location: string): Status | Appends a hyperlink covering the inclusive rectangle from (row, col) through (lastRow, lastCol). |
removeHyperlink | removeHyperlink(sheet: number, row: number, col: number): Status | Removes every hyperlink anchored at (row, col). |
removeHyperlinkAt | removeHyperlinkAt(sheet: number, index: number): Status | Removes the hyperlink at index. |
clearHyperlinks | clearHyperlinks(sheet: number): Status | Drops every hyperlink on sheet. |
getHyperlinks | getHyperlinks(sheet: number): ListResult<HyperlinkEntry> | Returns every hyperlink on sheet as a JS array. |
Threaded comments and persons
| Name | Signature | Description |
|---|---|---|
getThreadedComments | getThreadedComments(sheet: number): ThreadedCommentsResult | Lists the sheet's threaded comments, replies included. |
addThreadedComment | addThreadedComment(sheet: number, comment: Partial<ThreadedComment> & Pick<ThreadedComment, 'id' | 'text'>): Status | Adds a threaded comment. |
editThreadedComment | editThreadedComment(sheet: number, id: string, text: string, mentions: Mention[]): Status | Replaces the text and mentions of the comment with id. |
setThreadResolved | setThreadResolved(sheet: number, threadId: string, done: boolean): Status | Sets the resolved state of the thread opened by threadId. |
removeThreadedComment | removeThreadedComment(sheet: number, id: string): Status | Removes a comment; removing an opening comment removes its thread. |
getPersons | getPersons(): PersonsResult | Lists the workbook's persons. |
addPerson | addPerson(person: Person): Status | Appends a person to the workbook's person list. |
removePerson | removePerson(id: string): Status | Fails while a threaded comment or mention still names the person. |
AutoFilter
| Name | Signature | Description |
|---|---|---|
getSheetAutoFilterXml | getSheetAutoFilterXml(sheet: number): SheetAutoFilterXmlResult | Reads the complete worksheet-level <autoFilter> XML fragment. |
setSheetAutoFilterXml | setSheetAutoFilterXml(sheet: number, xml: string): Status | Replaces the worksheet-level <autoFilter> XML fragment; empty clears it. |
getAutoFilter | getAutoFilter(sheet: number): AutoFilterResult | Reads the sheet's typed AutoFilter; autoFilter is null when absent. |
setAutoFilter | setAutoFilter(sheet: number, filter: AutoFilter): Status | Replaces the sheet AutoFilter and its hidden _xlnm._FilterDatabase name. |
removeAutoFilter | removeAutoFilter(sheet: number): Status | Removes the sheet AutoFilter. |
applyAutoFilter | applyAutoFilter(sheet: number): Status | Hides every body row the criteria exclude and shows the rest, as Excel's Reapply does. |
clearAutoFilter | clearAutoFilter(sheet: number): Status | Drops every column criterion and shows all body rows. |
evaluateAutoFilter | evaluateAutoFilter(sheet: number): AutoFilterEvalResult | Evaluates the sheet AutoFilter without changing the sheet. |
getTableAutoFilter | getTableAutoFilter(table: number): AutoFilterResult | Table counterparts, addressed by the workbook-wide table index (tableAt). |
setTableAutoFilter | setTableAutoFilter(table: number, filter: AutoFilter): Status | Replaces the table's AutoFilter. |
removeTableAutoFilter | removeTableAutoFilter(table: number): Status | Removes the table's AutoFilter. |
applyTableAutoFilter | applyTableAutoFilter(table: number): Status | Hides every body row the table's criteria exclude and shows the rest. |
clearTableAutoFilter | clearTableAutoFilter(table: number): Status | Drops every column criterion and shows all body rows. |
evaluateTableAutoFilter | evaluateTableAutoFilter(table: number): AutoFilterEvalResult | Evaluates the table's AutoFilter without changing the sheet. |
Data validation
| Name | Signature | Description |
|---|---|---|
validateValue | validateValue(sheet: number, row: number, col: number, value: Value): ValidationOutcomeResult | Checks value against the validation rule covering (row, col) without storing it. |
listInvalidCells | listInvalidCells(sheet: number, cursor?: number | null, limit?: number | null): CellsInRangeResult | Enumerates populated cells whose value fails their validation rule, in row-major order, one page at a time; paging as getCellsInRange. |
getValidations | getValidations(sheet: number): ListResult<DataValidationEntry> | Returns every data-validation rule on sheet in storage order. |
addValidation | addValidation(sheet: number, validation: DataValidationInput): Status | Appends a data-validation rule to sheet. |
removeValidationAt | removeValidationAt(sheet: number, index: number): Status | Removes the validation rule at index. |
clearValidations | clearValidations(sheet: number): Status | Drops every validation rule on sheet. |
Conditional formats
| Name | Signature | Description |
|---|---|---|
evaluateCfRange | evaluateCfRange(sheet: number, firstRow: number, firstCol: number, lastRow: number, lastCol: number, todaySerial: number): CfRangeResult | Evaluates every CF block on sheet against the inclusive range [(firstRow, firstCol), (lastRow, lastCol)]. |
getConditionalFormats | getConditionalFormats(sheet: number): ListResult<ConditionalFormatEntry> | Returns every CF rule on sheet in flattened priority order. |
addConditionalFormat | addConditionalFormat(sheet: number, rule: ConditionalFormatInput): AddStyleResult | Appends a new single-rule <conditionalFormatting> block to sheet, including visual rules when their payload object is supplied. |
removeConditionalFormatAt | removeConditionalFormatAt(sheet: number, index: number): Status | Removes the CF rule at index (flattened order). |
clearConditionalFormats | clearConditionalFormats(sheet: number): Status | Drops every CF block on sheet. |
Images and drawings
| Name | Signature | Description |
|---|---|---|
probeImage | probeImage(bytes: Uint8Array): ImageInfoResult | Sniffs the format and pixel size of PNG, JPEG, GIF or BMP bytes without touching the workbook. |
listDrawingObjects | listDrawingObjects(sheet: number): ListResult<DrawingObject> | Lists the anchored objects of the sheet's drawing, in document order. |
getImage | getImage(sheet: number, objectId: number): ImageResult | Returns a copy of the media bytes of the picture objectId. |
insertImage | insertImage(sheet: number, bytes: Uint8Array, opts?: ImageInsertOptions): InsertImageResult | Inserts bytes as a picture; existing drawing content is kept. |
removeDrawing | removeDrawing(sheet: number, objectId: number): Status | Removes the picture or chart objectId and the parts only it reaches; other drawing content is kept. |
setDrawingAnchor | setDrawingAnchor(sheet: number, objectId: number, placement: ImagePlacement): Status | Moves and resizes the picture or chart objectId, keeping its id, crop, rotation and every other element. |
setDrawingZOrder | setDrawingZOrder(sheet: number, objectId: number, index: number): Status | Makes the picture or chart objectId item index of listDrawingObjects, whose order is the stacking order (0 is the back). |
snapshotDrawing | snapshotDrawing(sheet: number, objectId: number): ImageSnapshotResult | Captures the picture or chart objectId with its list position, element and dependent parts as opaque bytes for restoreDrawing. |
restoreDrawing | restoreDrawing(sheet: number, bytes: Uint8Array, opts?: RestoreImageOptions): InsertImageResult | Puts 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. |
listShapes | listShapes(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. |
insertShape | insertShape(sheet: number, spec: ShapeInput): InsertImageResult | Appends a shape on top and returns its id; a sheet without a drawing gets one and existing drawing content is kept. |
updateShape | updateShape(sheet: number, objectId: number, spec: ShapeInput): Status | Applies the fields spec names to the shape objectId; every other part of its XML is kept. |
removeShape | removeShape(sheet: number, objectId: number): Status | Removes the shape, connector or group objectId with its children. |
listSlicers | listSlicers(sheet: number): ListResult<Slicer> | Lists the table slicers the sheet hosts; slicers over a pivot cache are not listed. |
addSlicer | addSlicer(sheet: number, table: number, column: number, spec: SlicerInput): InsertImageResult | Adds a slicer over column column (0-based) of table table and returns its frame's id. |
updateSlicer | updateSlicer(sheet: number, index: number, spec: SlicerInput): Status | Applies the fields spec names to slicer index; every other part of its XML is kept. |
removeSlicer | removeSlicer(sheet: number, index: number): Status | Removes slicer index with its drawing frame, and its cache when no other slicer uses it. |
listSparklineGroups | listSparklineGroups(sheet: number): ListResult<SparklineGroup> | Lists the sheet's sparkline groups in document order with their sparklines. |
addSparklineGroup | addSparklineGroup(sheet: number, spec: SparklineGroupInput): Status | Appends a group; spec.sparklines must hold at least one sparkline. |
updateSparklineGroup | updateSparklineGroup(sheet: number, index: number, spec: SparklineGroupInput): Status | Rewrites the modelled attributes, colours and date range of group index; its sparklines and unmodelled XML are kept. |
setSparklineGroupSparklines | setSparklineGroupSparklines(sheet: number, index: number, sparklines: Sparkline[]): Status | Replaces the sparklines of group index. |
removeSparklineGroup | removeSparklineGroup(sheet: number, index: number): Status | Removes group index. |
Charts
| Name | Signature | Description |
|---|---|---|
getChart | getChart(sheet: number, objectId: number): ChartResult | Reads the typed view of the chart objectId. |
getChartData | getChartData(sheet: number, objectId: number): ChartDataResult | Resolves the chart's series against the current cell values. |
previewChartData | previewChartData(sheet: number, objectId: number, overrides: ChartPreviewOverrides): ChartDataResult | Resolves the series as if overrides were applied to the chart; the workbook is not changed. |
insertChart | insertChart(sheet: number, options: ChartInsertOptions): InsertChartResult | Creates a chart with filled caches and returns its object id. |
setChartType | setChartType(sheet: number, objectId: number, plot: number, kind: ChartInsertKind, grouping?: ChartGrouping): Status | Replaces plot group plot with kind; grouping applies to column, bar, line and area. |
setChartTitle | setChartTitle(sheet: number, objectId: number, title: string | null | { kind: ChartTitleKind; text?: string; formula?: string }): Status | Sets the chart title text, or removes the title with null. |
setChartLegend | setChartLegend(sheet: number, objectId: number, position: ChartLegendPosition, overlay: boolean, hiddenSeries?: number[]): Status | Sets the legend position (None removes it) and overlay; hiddenSeries (series c:idx values) replaces the hidden legend entries when given. |
setChartAxis | setChartAxis(sheet: number, objectId: number, axisId: number, patch: ChartAxisPatch): Status | Patches the axis axisId. |
setChartDisplay | setChartDisplay(sheet: number, objectId: number, blanksAs: ChartBlanksAs, plotVisibleOnly: boolean | null): Status | Sets how blanks are plotted and whether hidden cells are skipped; Absent and null remove the element. |
setChartSeries | setChartSeries(sheet: number, objectId: number, plot: number, seriesIdx: number, patch: ChartSeriesPatch): Status | Patches the series with c:idx seriesIdx of plot group plot. |
setChartPoint | setChartPoint(sheet: number, objectId: number, plot: number, seriesIdx: number, pointIdx: number, patch: ChartPointPatch | null): Status | Patches a data point; null or an empty patch removes its formatting. |
setChartPlot | setChartPlot(sheet: number, objectId: number, plot: number, patch: ChartPlotPatch): Status | Patches plot group plot. |
setChartFilter | setChartFilter(sheet: number, objectId: number, hiddenSeries: number[], hiddenCategories: number[]): Status | Replaces the chart filter: series by c:idx and categories by position are hidden. |
addChartSeries | addChartSeries(sheet: number, objectId: number, plot: number, patch: ChartSeriesPatch): AddChartSeriesResult | Appends a series to plot group plot; the patch must set values (y for a scatter plot). |
removeChartSeries | removeChartSeries(sheet: number, objectId: number, plot: number, seriesIdx: number): Status | Removes the series with c:idx seriesIdx from plot group plot. |
setChartSource | setChartSource(sheet: number, objectId: number, source: string, direction: ChartSeriesDirection, headerRow?: boolean, headerColumn?: boolean): Status | Rebuilds every series from source, keeping the chart kind and each series' formatting by idx, and clears the filter. |
Print settings and pagination
| Name | Signature | Description |
|---|---|---|
paginate | paginate(sheet: number): PaginationResult | Computes print-area page breaks and physical page count for sheet. |
getSheetPageSetupXml | getSheetPageSetupXml(sheet: number): SheetPrintXmlResult | Reads the worksheet's <pageSetup> fragment; empty when absent. |
setSheetPageSetupXml | setSheetPageSetupXml(sheet: number, xml: string): Status | Replaces <pageSetup>; empty removes it and restores the defaults. |
getSheetPageMarginsXml | getSheetPageMarginsXml(sheet: number): SheetPrintXmlResult | Reads the worksheet's <pageMargins> fragment; empty when absent. |
setSheetPageMarginsXml | setSheetPageMarginsXml(sheet: number, xml: string): Status | Replaces <pageMargins>; empty removes it. |
getSheetPrintOptionsXml | getSheetPrintOptionsXml(sheet: number): SheetPrintXmlResult | Reads the worksheet's <printOptions> fragment; empty when absent. |
setSheetPrintOptionsXml | setSheetPrintOptionsXml(sheet: number, xml: string): Status | Replaces <printOptions>; empty removes it. |
getSheetHeaderFooterXml | getSheetHeaderFooterXml(sheet: number): SheetPrintXmlResult | Reads the worksheet's <headerFooter> fragment; empty when absent. |
setSheetHeaderFooterXml | setSheetHeaderFooterXml(sheet: number, xml: string): Status | Replaces <headerFooter>; empty removes it. |
getSheetSheetPrXml | getSheetSheetPrXml(sheet: number): SheetPrintXmlResult | Reads the worksheet's <sheetPr> fragment; empty when absent. |
setSheetSheetPrXml | setSheetSheetPrXml(sheet: number, xml: string): Status | Replaces <sheetPr>; empty removes it. |
setSheetFitToPage | setSheetFitToPage(sheet: number, enabled: boolean): Status | Sets or clears <sheetPr><pageSetUpPr fitToPage> without disturbing anything else <sheetPr> carries. |
getSheetPrintArea | getSheetPrintArea(sheet: number): SheetPrintAreaResult | Reads _xlnm.Print_Area as comma-separated A1 ranges. |
setSheetPrintArea | setSheetPrintArea(sheet: number, rangesA1: string): Status | Writes _xlnm.Print_Area from one or more comma-separated A1 ranges ("A1:F8", "A1:B10,D5:E20", "A:D"). |
getSheetPrintTitles | getSheetPrintTitles(sheet: number): SheetPrintTitlesResult | Reads _xlnm.Print_Titles as a row span and a column span. |
setSheetPrintTitles | setSheetPrintTitles(sheet: number, repeatRows: string, repeatCols: string): Status | Writes _xlnm.Print_Titles. |
addSheetRowBreak | addSheetRowBreak(sheet: number, row: number, manual: boolean): Status | Upserts a row break before row, spanning the whole sheet. |
addSheetColBreak | addSheetColBreak(sheet: number, col: number, manual: boolean): Status | Upserts a column break before col, spanning the whole sheet. |
removeSheetRowBreak | removeSheetRowBreak(sheet: number, row: number): Status | Removes the row break at row. |
removeSheetColBreak | removeSheetColBreak(sheet: number, col: number): Status | Removes the column break at col. |
clearSheetBreaks | clearSheetBreaks(sheet: number): Status | Removes every manual break on both axes. |
getSheetRowBreaks | getSheetRowBreaks(sheet: number): SheetPageBreaksResult | Returns the row breaks, ascending by row. |
getSheetColBreaks | getSheetColBreaks(sheet: number): SheetPageBreaksResult | Returns the column breaks, ascending by column. |
setSheetPageSetup | setSheetPageSetup(sheet: number, setup: PageSetupInput): Status | Applies a partial <pageSetup> update. |
setSheetPageMargins | setSheetPageMargins(sheet: number, margins: PageMarginsInput): Status | Applies a partial <pageMargins> update, in inches. |
setSheetPrintOptions | setSheetPrintOptions(sheet: number, options: PrintOptionsInput): Status | Applies a partial <printOptions> update. |
setSheetHeaderFooter | setSheetHeaderFooter(sheet: number, headerFooter: HeaderFooterInput): Status | Applies a partial <headerFooter> update. |
getSheetPageSetup | getSheetPageSetup(sheet: number): SheetPageSetupResult | Reads the effective page setup and which attributes state it. |
getSheetPageMargins | getSheetPageMargins(sheet: number): SheetPageMarginsResult | Reads the effective page margins, in inches. |
PivotTables
| Name | Signature | Description |
|---|---|---|
pivotCount | pivotCount(sheet: number): NumberResult | Returns the number of PivotTables anchored on sheet. |
pivotLayout | pivotLayout(sheet: number, pivotIndex: number): PivotLayoutResult | Evaluates and projects a PivotTable into concrete grid cells. |
pivotCreate | pivotCreate(sheet: number, name: string, cacheId: number, anchorRow: number, anchorCol: number): AddStyleResult | Creates a new empty pivot table. |
pivotRemove | pivotRemove(sheet: number, pivotIdx: number): Status | Removes the pivot table at pivotIdx. |
pivotSetName | pivotSetName(sheet: number, pivotIdx: number, name: string): Status | Renames the pivot table. |
pivotSetAnchor | pivotSetAnchor(sheet: number, pivotIdx: number, anchorRow: number, anchorCol: number, spanRows: number, spanCols: number): Status | Updates the pivot's anchor cell and span. |
pivotSetGrandTotals | pivotSetGrandTotals(sheet: number, pivotIdx: number, rowsEnabled: boolean, colsEnabled: boolean): Status | Toggles the row / column grand total bands on the pivot. |
pivotSetStyleInfo | pivotSetStyleInfo(sheet: number, pivotIdx: number, info: PivotStyleInfo): Status | Sets the pivot's table style and toggles, making the style element present. |
pivotGetLayout | pivotGetLayout(sheet: number, pivotIdx: number): PivotReportLayoutResult | Reads the pivot's compact / tabular / outline report layout. |
pivotSetLayout | pivotSetLayout(sheet: number, pivotIdx: number, layout: PivotReportLayout): Status | Sets the pivot's compact / tabular / outline report layout. |
pivotName | pivotName(sheet: number, pivotIdx: number): StringResult | Reads the pivot's name. |
pivotGetGrandTotals | pivotGetGrandTotals(sheet: number, pivotIdx: number): PivotGrandTotalsResult | Reads the row / column grand total flags pivotSetGrandTotals writes. |
pivotGetStyleInfo | pivotGetStyleInfo(sheet: number, pivotIdx: number): PivotStyleInfoResult | Reads the table style pivotSetStyleInfo writes. |
pivotRowFieldOrder | pivotRowFieldOrder(sheet: number, pivotIdx: number): PivotFieldOrderResult | Reads the row-axis field order (the list pivotSetRowFieldOrder takes). |
pivotColFieldOrder | pivotColFieldOrder(sheet: number, pivotIdx: number): PivotFieldOrderResult | Reads the column-axis field order. |
pivotFieldCount | pivotFieldCount(sheet: number, pivotIdx: number): NumberResult | Number of fields configured on the pivot. |
pivotFieldAdd | pivotFieldAdd(sheet: number, pivotIdx: number, spec: PivotFieldSpec): AddStyleResult | Places a field on the pivot. |
pivotFieldAt | pivotFieldAt(sheet: number, pivotIdx: number, fieldIdx: number): PivotFieldResult | Reads the definition of field fieldIdx. |
pivotFieldItemCount | pivotFieldItemCount(sheet: number, pivotIdx: number, fieldIdx: number): NumberResult | Number of items in the field's item list (what pivotFieldAddItem / pivotFieldAddItemAt append to). |
pivotFieldItemAt | pivotFieldItemAt(sheet: number, pivotIdx: number, fieldIdx: number, itemIdx: number): PivotItemResult | Reads item itemIdx of the field; the index pivotFieldSetItemVisible takes. |
pivotFieldClear | pivotFieldClear(sheet: number, pivotIdx: number): Status | Drops every field from the pivot, emptying the row and column orders. |
pivotFieldSetAxis | pivotFieldSetAxis(sheet: number, pivotIdx: number, fieldIdx: number, axis: PivotAxis | -1): Status | Sets the axis of pivot field fieldIdx. |
pivotFieldSetSort | pivotFieldSetSort(sheet: number, pivotIdx: number, fieldIdx: number, order: PivotSortOrder, byField: string): Status | Sets the sibling order of pivot field fieldIdx. |
pivotFieldSetSubtotalTop | pivotFieldSetSubtotalTop(sheet: number, pivotIdx: number, fieldIdx: number, top: boolean): Status | Sets the subtotal_top flag on pivot field fieldIdx. |
pivotFieldAddItem | pivotFieldAddItem(sheet: number, pivotIdx: number, fieldIdx: number, name: string, visible: boolean): Status | Appends a manual-filter item to pivot field fieldIdx, addressed by its label. |
pivotFieldAddItemAt | pivotFieldAddItemAt(sheet: number, pivotIdx: number, fieldIdx: number, cacheIndex: number, visible: boolean): Status | Appends 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">. |
pivotFieldClearItems | pivotFieldClearItems(sheet: number, pivotIdx: number, fieldIdx: number): Status | Drops every manual-filter item from pivot field fieldIdx. |
pivotFieldSetItemVisible | pivotFieldSetItemVisible(sheet: number, pivotIdx: number, fieldIdx: number, itemIdx: number, visible: boolean): Status | Toggles the visibility of item itemIdx on field fieldIdx. |
pivotFieldAddSubtotalFn | pivotFieldAddSubtotalFn(sheet: number, pivotIdx: number, fieldIdx: number, agg: PivotAggregation): Status | Appends a subtotal-fn entry to pivot field fieldIdx. |
pivotFieldClearSubtotalFns | pivotFieldClearSubtotalFns(sheet: number, pivotIdx: number, fieldIdx: number): Status | Drops every subtotal-fn entry from pivot field fieldIdx. |
pivotFieldSetDateGroup | pivotFieldSetDateGroup(sheet: number, pivotIdx: number, fieldIdx: number, granularity: PivotDateGrouping, calendar: PivotCalendar, startYear: number, endYear: number, intervalDays?: number, startSerial?: number, endSerial?: number): Status | Configures date-grouping on pivot field fieldIdx. |
pivotFieldClearDateGroup | pivotFieldClearDateGroup(sheet: number, pivotIdx: number, fieldIdx: number): Status | Removes the date-grouping config from pivot field fieldIdx. |
pivotFieldSetNumberFormat | pivotFieldSetNumberFormat(sheet: number, pivotIdx: number, fieldIdx: number, utf8: string): Status | Sets the numFmtId of pivot field fieldIdx, as a decimal string naming a built-in id or one returned by addNumFmt. |
pivotSetRowFieldOrder | pivotSetRowFieldOrder(sheet: number, pivotIdx: number, indices: ReadonlyArray<number>): Status | Replaces the row-axis field order with indices. |
pivotSetColFieldOrder | pivotSetColFieldOrder(sheet: number, pivotIdx: number, indices: ReadonlyArray<number>): Status | Replaces the column-axis field order. |
pivotDataFieldCount | pivotDataFieldCount(sheet: number, pivotIdx: number): NumberResult | Number of <dataField> entries on the pivot. |
pivotDataFieldAdd | pivotDataFieldAdd(sheet: number, pivotIdx: number, spec: PivotDataFieldSpec): AddStyleResult | Appends a new data-field entry. |
pivotDataFieldAt | pivotDataFieldAt(sheet: number, pivotIdx: number, dataFieldIdx: number): PivotDataFieldResult | Reads data field dataFieldIdx. |
pivotDataFieldClear | pivotDataFieldClear(sheet: number, pivotIdx: number): Status | Drops every data-field entry from the pivot. |
pivotDataFieldSet | pivotDataFieldSet(sheet: number, pivotIdx: number, dataFieldIdx: number, spec: PivotDataFieldSpec): Status | Replaces the data-field entry at dataFieldIdx in place. |
pivotFilterCount | pivotFilterCount(sheet: number, pivotIdx: number): NumberResult | Number of filters on the pivot -- see PivotFilterResult. |
pivotFilterAdd | pivotFilterAdd(sheet: number, pivotIdx: number, spec: PivotFilterSpec): Status | Appends a filter, saved with the pivot; see PivotFilterResult. |
pivotFilterAt | pivotFilterAt(sheet: number, pivotIdx: number, filterIdx: number): PivotFilterResult | Reads the filter at filterIdx; see PivotFilterResult. |
pivotFilterClear | pivotFilterClear(sheet: number, pivotIdx: number): Status | Drops every listed filter from the pivot. |
pivotFilterRemoveAt | pivotFilterRemoveAt(sheet: number, pivotIdx: number, filterIdx: number): Status | Removes the filter at filterIdx. |
Pivot caches
| Name | Signature | Description |
|---|---|---|
pivotCacheCount | pivotCacheCount(): NumberResult | Returns the number of pivot caches owned by the workbook. |
pivotCacheIdAt | pivotCacheIdAt(idx: number): AddStyleResult | Returns { status, index: cacheId } for the cache at flat index idx. |
pivotCacheCreate | pivotCacheCreate(requestedId: number): AddStyleResult | Creates a new empty pivot cache. |
pivotCacheRemove | pivotCacheRemove(cacheId: number): Status | Removes the pivot cache with id cacheId. |
pivotCacheGetWorksheetSource | pivotCacheGetWorksheetSource(cacheId: number): PivotWorksheetSourceResult | Reads the cache's worksheet source range / defined-name metadata. |
pivotCacheSetWorksheetSource | pivotCacheSetWorksheetSource(cacheId: number, source: PivotWorksheetSource): Status | Sets or clears the cache's worksheet source metadata. |
pivotCacheFieldCount | pivotCacheFieldCount(cacheId: number): NumberResult | Number of fields on the cache identified by cacheId. |
pivotCacheFieldName | pivotCacheFieldName(cacheId: number, fieldIdx: number): StringResult | Reads the name of the cache field at fieldIdx. |
pivotCacheFieldAdd | pivotCacheFieldAdd(cacheId: number, name: string): AddStyleResult | Appends a new field with the given UTF-8 name to the cache. |
pivotCacheFieldClear | pivotCacheFieldClear(cacheId: number): Status | Drops every field (and every record) from the cache. |
pivotCacheFieldSharedItemCount | pivotCacheFieldSharedItemCount(cacheId: number, fieldIdx: number): NumberResult | Number of shared items configured on cache field fieldIdx. |
pivotCacheFieldAddSharedItemNumber | pivotCacheFieldAddSharedItemNumber(cacheId: number, fieldIdx: number, value: number): Status | Appends a numeric shared item to cache field fieldIdx. |
pivotCacheFieldAddSharedItemText | pivotCacheFieldAddSharedItemText(cacheId: number, fieldIdx: number, value: string): Status | Appends a text shared item to cache field fieldIdx. |
pivotCacheFieldAddSharedItemBool | pivotCacheFieldAddSharedItemBool(cacheId: number, fieldIdx: number, value: boolean): Status | Appends a boolean shared item to cache field fieldIdx. |
pivotCacheFieldAddSharedItemBlank | pivotCacheFieldAddSharedItemBlank(cacheId: number, fieldIdx: number): Status | Appends a blank shared item to cache field fieldIdx. |
pivotCacheFieldAddSharedItemError | pivotCacheFieldAddSharedItemError(cacheId: number, fieldIdx: number, errorCode: number): Status | Appends an Excel error shared item to cache field fieldIdx. |
pivotCacheFieldClearSharedItems | pivotCacheFieldClearSharedItems(cacheId: number, fieldIdx: number): Status | Drops every shared item from cache field fieldIdx. |
pivotCacheRecordCount | pivotCacheRecordCount(cacheId: number): NumberResult | Returns the number of records on the cache. |
pivotCacheRecordAdd | pivotCacheRecordAdd(cacheId: number): AddStyleResult | Appends a new empty record. |
pivotCacheRecordClear | pivotCacheRecordClear(cacheId: number): Status | Drops every record from the cache. |
pivotCacheRecordSetNumber | pivotCacheRecordSetNumber(cacheId: number, recordIdx: number, fieldIdx: number, value: number): Status | Sets cell (recordIdx, fieldIdx) to a numeric value. |
pivotCacheRecordSetText | pivotCacheRecordSetText(cacheId: number, recordIdx: number, fieldIdx: number, value: string): Status | Sets cell (recordIdx, fieldIdx) to a UTF-8 text value. |
pivotCacheRecordSetBool | pivotCacheRecordSetBool(cacheId: number, recordIdx: number, fieldIdx: number, value: boolean): Status | Sets cell (recordIdx, fieldIdx) to a boolean value. |
pivotCacheRecordSetBlank | pivotCacheRecordSetBlank(cacheId: number, recordIdx: number, fieldIdx: number): Status | Sets cell (recordIdx, fieldIdx) to Blank. |
pivotCacheRecordSetError | pivotCacheRecordSetError(cacheId: number, recordIdx: number, fieldIdx: number, errorCode: number): Status | Sets cell (recordIdx, fieldIdx) to an Excel error value. |
pivotCacheId | pivotCacheId(sheet: number, pivotIdx: number): AddStyleResult | Returns { 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:
Read next
- Workbook lifecycle — engine-side flow.
- Workbook operations — sheets, cells, structures.
- Presentation and geometry — display text, themes, styles, dimensions, and pagination.
- Filters and validation — AutoFilter state and proposed-value checks.
- Comments and images — threaded comments, persons, drawing objects, and pictures.
- Dynamic arrays — spill semantics referenced above.
- Compatibility / Error model — what each error code means.
- File format support — what XLSB currently round-trips.