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

{
    "userEnteredValue": {
        "stringValue": "20"
    },
    "effectiveValue": {
        "numberValue": 20
    },
    "formattedValue": "$20",
    "effectiveFormat": {
        "horizontalAlignment": "right",
        "numberFormat": {
            "type": "CURRENCY",
            "pattern": "\"$\"#,##0"
        }
    },
    "userEnteredFormat": {
        "numberFormat": {
            "type": "CURRENCY",
            "pattern": "\"$\"#,##0"
        }
    }
}

Last updated

Was this helpful?