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

string | null

CellContainer

Cell

dataTable: DataTable | null = null;

Data table metadata, set only on the anchor cell of the data table range.


f: string | null;

formula, if any

CellInterface.f


optional ft: "a" | null;

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: string | null;

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


userZ: string | null = null;

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


z: string | null = 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(): string | null;

string | null


get formulaZ(): string | null;

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

string | null

CellInterface.formulaZ


get href(): string | null;

string | null

set href(href): void;

string | null

void


get hrefFromFormula(): string | null;

Hyperlink URL derived from HYPERLINK() formula evaluation (ephemeral).

string | null

set hrefFromFormula(url): void;

string | null

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 sheetIndex(): number;

number

CellInterface.sheetIndex


get style(): StyleRelaxed | null;

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

StyleRelaxed | null

set style(newStyle): void;

StyleRelaxed | null

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