Cell
Cell object. Instances of this are stored in the cell map of each sheet of each Workbook.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Cell( orgCell, id?, container?): Cell;Construct a Cell instance.
Parameters
Section titled “Parameters”orgCell
Section titled “orgCell”object to copy attributes from (all optional, this may be empty)
Cell | CellData
unqualified address in A1 format
string | null
container?
Section titled “container?”CellContainer
Returns
Section titled “Returns”Cell
Properties
Section titled “Properties”dataTable
Section titled “dataTable”dataTable: DataTable | null = null;Data table metadata, set only on the anchor cell of the data table range.
f: string | null;formula, if any
Implementation of
Section titled “Implementation of”optional ft: "a" | null;Formula type, ‘a’ for array formula, absent for single-cell formula.
Implementation of
Section titled “Implementation of”id: string;this cell’s address ID in A1 format (unprefixed)
Implementation of
Section titled “Implementation of”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.
Implementation of
Section titled “Implementation of”Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get _v(): CellValue;Returns
Section titled “Returns”Set Signature
Section titled “Set Signature”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
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
colIndex
Section titled “colIndex”Get Signature
Section titled “Get Signature”get colIndex(): number;Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get F(): string | null;Returns
Section titled “Returns”string | null
formulaZ
Section titled “formulaZ”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”string | null
Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get href(): string | null;Returns
Section titled “Returns”string | null
Set Signature
Section titled “Set Signature”set href(href): void;Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”void
hrefFromFormula
Section titled “hrefFromFormula”Get Signature
Section titled “Get Signature”get hrefFromFormula(): string | null;Hyperlink URL derived from HYPERLINK() formula evaluation (ephemeral).
Returns
Section titled “Returns”string | null
Set Signature
Section titled “Set Signature”set hrefFromFormula(url): void;Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”void
resetValueBoxed
Section titled “resetValueBoxed”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”rowIndex
Section titled “rowIndex”Get Signature
Section titled “Get Signature”get rowIndex(): number;Returns
Section titled “Returns”number
sheetIndex
Section titled “sheetIndex”Get Signature
Section titled “Get Signature”get sheetIndex(): number;Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”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 forstyle.numberFormatzf- Convenience shortcut forstyle.numberFormatFromFormula(read-only via getter, can be set via constructor)
The setter accepts either:
- A
StyleRelaxedobject (will be deduplicated and stored by index) - A numeric style index (for efficiency when you already have the index)
null(to clear the style)
Example
Section titled “Example”// Set a style objectcell.style = { color: '#FF0000', bold: true };
// Clear the stylecell.style = null;
// Use the convenience propertiescell.z = '@'; // Sets style.numberFormatReturns
Section titled “Returns”StyleRelaxed | null
Set Signature
Section titled “Set Signature”set style(newStyle): void;Parameters
Section titled “Parameters”newStyle
Section titled “newStyle”StyleRelaxed | null
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get v(): CellValue;Returns
Section titled “Returns”Set Signature
Section titled “Set Signature”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
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”valueBoxed
Section titled “valueBoxed”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”workbookKey
Section titled “workbookKey”Get Signature
Section titled “Get Signature”get workbookKey(): number;Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”clear()
Section titled “clear()”clear(): void;Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”edit()
Section titled “edit()”edit(cellData): void;Parameters
Section titled “Parameters”cellData
Section titled “cellData”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”hasValue()
Section titled “hasValue()”hasValue(): boolean;Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”hasValueOrFormula()
Section titled “hasValueOrFormula()”hasValueOrFormula(): boolean;Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”CellInterface.hasValueOrFormula
isBlank()
Section titled “isBlank()”isBlank(): boolean;Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”isSpillAnchor()
Section titled “isSpillAnchor()”isSpillAnchor(): boolean;Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”isSpilled()
Section titled “isSpilled()”isSpilled(): this is Cell & { _spill: { valid: true }; F: string; sheetIndex: number };Is part of a spilled range.
Returns
Section titled “Returns”this is Cell & { _spill: { valid: true }; F: string; sheetIndex: number }
Implementation of
Section titled “Implementation of”spillHeight()
Section titled “spillHeight()”spillHeight(): number;Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”spillWidth()
Section titled “spillWidth()”spillWidth(): number;Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”toString()
Section titled “toString()”toString(): string;Returns
Section titled “Returns”string