Skip to content

CellInterface

Common interface for cell-like objects (Cell and DefinedName). Defines the shared properties and methods between cells in sheets and defined names.

_ast: ASTRootNode

Cached abstract syntax tree, if this.f has been parsed.

Slight wart: an ASTNode can be a literal cell value, including null, but in this attribute, null means that the cell does not have an AST, not that it has an AST consisting of a single null node. This does not cause serious ambiguity in practice, because a null AST node only really makes sense in particular contexts, i.e. as elements of arrays and function call arguments, not as the root of an abstract syntax tree.


_container: null | CellContainer


_spill: null | RTreeMatrixNode

R-Tree node of the spill range containing this cell. Null for defined names.


f: null | string

formula, if any


optional ft: null | "a"

Formula type, ‘a’ for array formula, absent for single-cell formula.


id: string

this cell’s address ID in A1 format (unprefixed), or defined name


neutralizedFormula: null | string

Formula which was neutralized by a write to/overlapping this cell


state: number

State for recalcWithMarkAndEvalQueue. The delta cell.state - wb._recalcState.upToDateState is what’s meaningful:

  • +1 == DIRTY - may require recomputation (because an ancestor changed) but has not been enqueued for recomputation (because the recalculation has not propagated to this cell or another that depends transitively on it)
  • +2 == ENQUEUEING - the cell’s dependencies are being enqueued (state used to detect static circular dependencies)
  • +3 == ENQUEUED_MAYBE - enqueued to ensure correct evaluation order because some other cell that depends transitively on this cell has been enqueued for recalculation, but this cell is not yet known to require recomputation, because we have not observed a change in a direct dependency of this cell
  • +3 == ENQUEUED_CALC - enqueued and known to require recomputation, because some direct dependency of this cell has changed
  • +5 == the new UPTODATE, during a recalculation (at the end of which wb._recalcState.upToDateState gets set to this)
  • +5 can’t happen

  • <= 0 == UPTODATE - the cell value is known to be up-to-date (it may have been dirtied in an earlier recalculation which then did not propagate to it, because each actual dependency path from a recalculation root to this cell included a cell that evaluated to the same value as before)

At the end of a recalculation, wb._recalcState.upToDateState is incremented by NUM_STATES, so any cells that were not reached by the recalculation (because all their dependencies were unchanged) will then have this delta < 0 and thus be automatically deemed up-to-date at the next recalculation.


vertexId: CellVertexId | NameVertexId

Cached vertex ID for dependency graph operations

get formulaZ(): null | string

The cell’s formula-assigned number format, if present.

null | string


get sheetIndex(): null | number

null | number


get v(): null | string | number | boolean | FormulaError | Lambda | Reference | Matrix

null | string | number | boolean | FormulaError | Lambda | Reference | Matrix

set v(value): void

MaybeBoxedFormulaValue

void


get valueBoxed(): MaybeBoxedFormulaValue

The value of the cell. If the cell’s value has a formula-assigned number format, the value will be a boxed value containing that number format.

MaybeBoxedFormulaValue


get workbookKey(): number

number


get z(): null | string

The effective number format of the cell.

The effective number format is the user-assigned number format, if present. Otherwise, it is the formula-assigned number format.

null | string

clear(): void

void


edit(cellData): void

JSFCellExpanded

void


hasValue(): boolean

boolean


hasValueOrFormula(): boolean

boolean


isBlank(): boolean

boolean

hasValueOrFormula


isSpillAnchor(): boolean

boolean


isSpilled(): this is Cell & { _spill: { valid: true }; F: string; sheetIndex: number }

this is Cell & { _spill: { valid: true }; F: string; sheetIndex: number }


spillHeight(): number

number


spillWidth(): number

number


toString(): string

string