Skip to content

Cell

Cell object. Instances of this are stored in the cell map of each sheet of each Workbook.

new Cell(orgCell, id?, container?): Cell

Construct a Cell instance.

object to copy attributes from (all optional, this may be empty)

Cell | CellData

unqualified address in A1 format

null | string

CellContainer

Cell

_ast: ASTRootNode

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

CellInterface._ast


_container: null | CellContainer = null

CellInterface._container


_spill: null | RTreeMatrixNode = null

R-Tree node of the spill range containing this cell.

CellInterface._spill


f: null | string

formula, if any

CellInterface.f


optional ft: null | "a"

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

CellInterface.ft


id: string

this cell’s address ID in A1 format (unprefixed)

CellInterface.id


M: null | string

top-left anchor cell-id of merge-area if cell is merge


neutralizedFormula: null | string = null

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

CellInterface.neutralizedFormula


state: number

State for recalcWithMarkAndEvalQueue

CellInterface.state


userZ: null | string = null

The user-assigned number format. Exposed as a plain property only for performance; do not modify this directly.


vertexId: CellVertexId

Cached vertex ID for this cell. Storing this avoids repeatedly constructing CellVertexId instances in hot paths. Note: This is mutable to support cell moves (when cell.id is reassigned).

CellInterface.vertexId


z: null | string = null

The effective number format of the cell (cached). Updated automatically when style or value changes.

CellInterface.z

get _v(): CellValue

CellValue

set _v(value): void

Set the reset value of the cell. If the value is a boxed value, the number format will become the cell’s formula-assigned number format on reset.

Note: Accepts MaybeBoxed for now, but will coerce Lambda to ERROR_CALC_LAMBDA_NOT_ALLOWED at runtime. XXX Clean this up, the coercion belongs outside this class

MaybeBoxed<ArrayValue>

void


get colIndex(): number

number


get F(): null | string

null | string


get formulaZ(): null | string

The cell’s formula-assigned number format (read-only accessor). Returns the number format from the boxed value metadata if present.

null | string

CellInterface.formulaZ


get href(): null | string

null | string

set href(href): void

null | string

void


get resetValueBoxed(): MaybeBoxed<CellValue>

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

MaybeBoxed<CellValue>


get rowIndex(): number

number


get s(): undefined | number

undefined | number


get sheetIndex(): number

number

CellInterface.sheetIndex


get style(): null | StyleRelaxed

The cell’s style object containing formatting properties like fonts, colors, borders, and number formats.

Migration note: This property was previously named s. Code accessing cell.s should be updated to use cell.style instead.

Related properties:

  • z (getter/setter) - Convenience shortcut for style.numberFormat
  • zf - Convenience shortcut for style.numberFormatFromFormula (read-only via getter, can be set via constructor)

The setter accepts either:

  • A StyleRelaxed object (will be deduplicated and stored by index)
  • A numeric style index (for efficiency when you already have the index)
  • null (to clear the style)
// Set a style object
cell.style = { color: '#FF0000', bold: true };
// Clear the style
cell.style = null;
// Use the convenience properties
cell.z = '@'; // Sets style.numberFormat

null | StyleRelaxed

set style(newStyle): void

null | StyleRelaxed

void


get v(): CellValue

CellValue

set v(value): void

Set the value of the cell. If the value is a boxed value, the number format will become the cell’s formula-assigned number format.

Note: Accepts MaybeBoxed for now, but will coerce Lambda to ERROR_CALC_LAMBDA_NOT_ALLOWED at runtime. XXX Clean this up, the coercion belongs outside this class

MaybeBoxed<ArrayValue>

void

CellInterface.v


get valueBoxed(): MaybeBoxed<CellValue>

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.

MaybeBoxed<CellValue>

CellInterface.valueBoxed


get workbookKey(): number

number

CellInterface.workbookKey

clear(): void

void

CellInterface.clear


edit(cellData): void

CellData

void

CellInterface.edit


hasValue(): boolean

boolean

CellInterface.hasValue


hasValueOrFormula(): boolean

boolean

CellInterface.hasValueOrFormula


isBlank(): boolean

boolean

hasValueOrFormula

CellInterface.isBlank


isSpillAnchor(): boolean

boolean

CellInterface.isSpillAnchor


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

Is part of a spilled range.

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

CellInterface.isSpilled


spillHeight(): number

number

CellInterface.spillHeight


spillWidth(): number

number

CellInterface.spillWidth


toString(): string

string

CellInterface.toString