The Candid Startup
    Preparing search index...

    Interface SpreadsheetData<Snapshot>

    Interface used to access the data in a spreadsheet

    The data exposed through the interface may change over time outside of any changes made through the interface. The caller can use the subscribe method to be notified when the data changes. When reading data, the caller must first request a snapshot using getSnapshot. All values returned by gettors are relative to a specified snapshot. The values will be consistent with each other as long as the same snapshot is used.

    interface SpreadsheetData<Snapshot> {
        getCellFormat(
            snapshot: Snapshot,
            row: number,
            column: number,
        ): CellFormat;
        getCellValue(snapshot: Snapshot, row: number, column: number): CellValue;
        getColumnCount(snapshot: Snapshot): number;
        getColumnItemOffsetMapping(snapshot: Snapshot): ItemOffsetMapping;
        getLoadStatus(snapshot: Snapshot): Result<boolean, StorageError>;
        getRowCount(snapshot: Snapshot): number;
        getRowItemOffsetMapping(snapshot: Snapshot): ItemOffsetMapping;
        getSnapshot(): Snapshot;
        getViewport(snapshot: Snapshot): SpreadsheetViewport | undefined;
        isValidCellValueAndFormat(
            row: number,
            column: number,
            value: CellValue,
            format: CellFormat,
        ): Result<void, ValidationError>;
        setCellValueAndFormat(
            row: number,
            column: number,
            value: CellValue,
            format: CellFormat,
        ): ResultAsync<void, SpreadsheetDataError>;
        setViewport(viewport: SpreadsheetViewport | undefined): void;
        subscribe(onDataChange: () => void): () => void;
    }

    Type Parameters

    • Snapshot

      Type of snapshot. Implementations are free to use whatever type makes sense for them.

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Set viewport of interest

      Can be used by SpreadsheetData implementations to optimize data retrieval and memory usage. Queries for cells outside the viewport may return undefined. Clients should not rely on any particular behavior for queries outside the viewport.

      Set to undefined (the default) if the client needs access to the entire spreadsheet

      Parameters

      Returns void