Skip to content

utils/cell Functions

Functions exported from src/utils/cell.ts

decodeCell

function decodeCell(cstr: string): CellAddress

Parameters

NameTypeDescription
cstrstringCell reference string (e.g.

Returns

CellAddress

Zero-based cell address {c: column, r: row}


decodeCol

function decodeCol(colstr: string): number

Parameters

NameTypeDescription
colstrstringColumn label string, possibly with "$" prefix

Returns

number

Zero-based column index (A=0, B=1, ..., Z=25, AA=26, ...)


decodeRange

function decodeRange(range: string): Range

Parameters

NameTypeDescription
rangestringRange string in A1 notation

Returns

Range

Range object with start (s) and end (e) addresses


decodeRow

function decodeRow(rowstr: string): number

Parameters

NameTypeDescription
rowstrstringRow string, possibly with a "$" absolute marker (e.g.

Returns

number

Zero-based row index


encodeCell

function encodeCell(cell: CellAddress): string

Parameters

NameTypeDescription
cellCellAddressZero-based cell address

Returns

string

A1-style cell reference (e.g. "A1" for {c

, r
})


encodeCol

function encodeCol(col: number): string

Parameters

NameTypeDescription
colnumberZero-based column index

Returns

string

Column label string


encodeRange

function encodeRange(cs: CellAddress | Range, ce?: CellAddress): string

Parameters

NameTypeDescription
cs`CellAddressRange`
ce (optional)CellAddressOptional end CellAddress (when cs is a CellAddress)

Returns

string

Range string in A1 notation (e.g. "A1

" or "A1")


encodeRow

function encodeRow(row: number): string

Parameters

NameTypeDescription
rownumberZero-based row index

Returns

string

1-based row string (e.g. "1" for row index 0)