For the complete documentation index, see llms.txt. This page is also available as Markdown.

SheetCell

Sheet Cell is a primitive to generate CellData object

How to use SheetCell

import { SheetCell } from "@rowsncolumns/spreadsheet-state"

const sheetCell = new SheetCell()

// Extend if necessary from existing cellData
const existingCellData = {}
sheetCell.assign(sheetId, { rowIndex, columnIndex }, existingCellData) 

// Set user entered value
sheetCell.setUserEnteredValue("$20")

// Get cell data
const cellData = sheetCell.getCellData()

CellData is the cell representation used in Spreadsheet 2. Short-form keys (ue / ev / uf / fv) are preferred for new writes — see Cell Data for the full type. The same short-form convention applies inside ExtendedValue: nv (number), sv (string), bv (bool), fv (formula), ev (error).

{
    "ue": {
        "sv": "20"
    },
    "ev": {
        "nv": 20
    },
    "fv": "$20",
    "uf": {
        "numberFormat": {
            "type": "CURRENCY",
            "pattern": "\"$\"#,##0"
        }
    }
}

effectiveFormat / ef are no longer written on CellData. The renderer derives the effective format on the fly from uf, the cell value, and (for formula cells) precedent formats. Older saved data with effectiveFormat still loads.

Last updated