Skip to content

Cell ​

Represents a single cell with value, metadata, and optional format.

ts
import { Cell } from "betterspread"

Constructor ​

ts
new Cell(opts: CellOptions)

CellOptions ​

PropertyTypeDefaultDescription
valuestring—Cell value
label?string"A"Column label
rowIndex?number1Row number
cellIndex?number0Column index
tab?TabInstance—Parent Tab
row?RowInstance | nullnullParent Row
format?CellFormat | Format—Cell formatting

Properties ​

PropertyTypeDescription
valuestring (readonly)Cell value
labelstring (readonly)Column label (e.g. "B")
rowIndexnumber (readonly)Row number
cellIndexnumber (readonly)Column index (0-based)
tabTabInstance | undefined (readonly)Parent Tab
rowRowInstance | null (readonly)Parent Row
formatFormat | nullCell format
headerstring (getter)Column header from Tab cache

Methods ​

update() ​

ts
update(opts: CellUpdateOpts): Promise<this>

Updates cell value and optional format. Returns this for chaining.

CellUpdateOpts ​

PropertyTypeDescription
valuestringNew value
format?FormatOptional cell format
inputFormat?ValueInputOption"RAW" (default) or "USER_ENTERED"

clear() ​

ts
clear(): Promise<void>

Clears the cell value.

style() ​

ts
style(style: Format): Promise<void>

Applies a Format to this cell.

delete() ​

ts
delete(shift: "left" | "up" = "up"): Promise<void>

Deletes the cell, shifting remaining cells up or left. Default "up", matching Tab.delCell.

toString() ​

ts
toString(): string

Returns cell value. Called implicitly on string coercion.

toJSON() ​

ts
toJSON(): string

Returns cell value for JSON serialization.