Wraps an existing cell data object. Typically obtained via Worksheet.cell().
The underlying cell data model.
Optionalstyles: StylesData
Optional shared styles for number format resolution.
OptionaldateSystem: () => DateSystem
Internal: reads the owning workbook's date system for Cell.dateValue; absent means the 1900 system.
Returns a Date if this cell contains a date-formatted number, or null otherwise.
Uses the cell's number format to determine whether the numeric value
represents a date, and the workbook's date system (1900 or 1904) for the epoch.
Returns the cell's formula text as stored, or null if no formula is set. A formula read from a file has no leading =; text given to the setter is kept as given, and the writer drops one leading = when it writes <f>.
Sets or clears the cell's formula. A formula cell takes the type of its
cached value (see Cell.value): "formulaStr" for a string,
"number" for a number or no value. Clearing the formula (null, or an empty
string, which is stored as null so the getter returns null) removes
formulaType, formulaRef and sharedIndex with it, and turns a "formulaStr"
cell into "sharedString", or "number" when it holds no value.
Formula text set on a shared-formula child (formulaType "shared" or a
sharedIndex, and no formulaRef, whether or not it carries formula text of its
own) gives that child a plain formula of its own: its formulaType and
sharedIndex are removed. New text on any other cell, a shared-formula master
(one with a formulaRef) included, keeps those keys. The children of a master
follow its text: a new text is theirs on write, and once the master's formula is
cleared, a child without text of its own is written with its cached value alone
(empty when it holds none) and a child with text of its own as a plain formula.
Returns the resolved number format code (e.g., "#,##0.00", "yyyy-mm-dd"),
or null if the cell uses the default General format.
The workbook's own numFmts win, then the built-in table. A built-in date id
the table has no code for (27-36, 50-55, 57 and 58) resolves to the code of id
14. Other ids without a code (5-8, 23-26 and 41-44) return null unless the
file defines them.
Returns the A1-style cell reference (e.g., "B3").
Returns the rich text runs for this cell, or undefined if the cell
has no rich text formatting. Each run contains a text segment and
optional formatting properties (bold, italic, underline, strike,
fontName, fontSize, color).
Sets rich text runs on this cell, enabling mixed formatting within a
single cell. The cell type is automatically set to "sharedString" and
the plain-text value is updated to the concatenation of all run texts.
On a shared-formula child (no formula text, but formulaType "shared" or a
sharedIndex), the rich text replaces the formula, as a value does:
formulaType, formulaRef and sharedIndex are removed.
Pass undefined to clear rich text.
Returns the 0-based index into Workbook.styles.cellXfs, or null if using the default style.
Sets the style index, or pass null to clear custom styling.
Returns the cell's data type (e.g., "number", "sharedString", "boolean", "error").
A formula cell takes the type of its cached value: "formulaStr" only when
that value is a string.
Returns the cell value, coerced to the appropriate JS type based on cellType.
Sets the cell value and auto-detects the cell type from the JS type.
Strings become shared strings, numbers stay numeric, booleans become "1"/"0".
Any rich text on the cell is cleared. With a formula set, the value is the
cached result and the type follows it: "formulaStr" for a string,
"number" for a number or null, "boolean" for a boolean; an "error"
formula cell keeps its type. A null value on a cell without a formula makes it a
"number" cell.
On a shared-formula child (no formula text, but formulaType "shared" or a
sharedIndex), any value, null included, replaces the formula: formulaType,
formulaRef and sharedIndex are removed. A cell with formula text keeps them.
Represents a single cell within a worksheet row. Mutations are applied directly to the underlying data.
Obtained via
Worksheet.cell(). Settingvalueauto-detects the cell type from the JS type (string, number, boolean).Example