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
null | string
container?
Section titled “container?”CellContainer
Returns
Section titled “Returns”Cell
Properties
Section titled “Properties”_ast:
ASTRootNode
Cached abstract syntax tree, if this.f has been parsed.
Implementation of
Section titled “Implementation of”_container
Section titled “_container”_container:
null|CellContainer=null
Implementation of
Section titled “Implementation of”_spill
Section titled “_spill”_spill:
null|RTreeMatrixNode=null
R-Tree node of the spill range containing this cell.
Implementation of
Section titled “Implementation of”f:
null|string
formula, if any
Implementation of
Section titled “Implementation of”
optionalft:null|"a"
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:
null|string
top-left anchor cell-id of merge-area if cell is merge
neutralizedFormula
Section titled “neutralizedFormula”neutralizedFormula:
null|string=null
Formula which was neutralized by a write to/overlapping this cell
Implementation of
Section titled “Implementation of”CellInterface.neutralizedFormula
state:
number
State for recalcWithMarkAndEvalQueue
Implementation of
Section titled “Implementation of”userZ:
null|string=null
The user-assigned number format. Exposed as a plain property only for performance; do not modify this directly.
vertexId
Section titled “vertexId”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).
Implementation of
Section titled “Implementation of”z:
null|string=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():
null|string
Returns
Section titled “Returns”null | string
formulaZ
Section titled “formulaZ”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”null | string
Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get href():
null|string
Returns
Section titled “Returns”null | string
Set Signature
Section titled “Set Signature”set href(
href):void
Parameters
Section titled “Parameters”null | string
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
Get Signature
Section titled “Get Signature”get s():
undefined|number
Returns
Section titled “Returns”undefined | 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():
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 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”null | StyleRelaxed
Set Signature
Section titled “Set Signature”set style(
newStyle):void
Parameters
Section titled “Parameters”newStyle
Section titled “newStyle”null | StyleRelaxed
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