Imperative grid handle for document commands, events, rendering, and teardown.
Examples
});}See also
Members 90
store
actions Imperative action surface for binding custom toolbars/menus.
getRuntimeResourceSnapshot Versioned coarse runtime ownership snapshot, including datasource state.
getRuntimeResourceSnapshot(operation: RuntimeResourceOperation, phase: RuntimeResourcePhase, runtime?: RuntimeMemoryObservation): RuntimeResourceSnapshot;getCommandState Query undo/redo availability and formatting active/mixed/disabled state.
setActiveSheet
scrollToCell
getCellAtPoint Resolve browser viewport coordinates to an active-sheet cell for host-owned menus and interactions.
Resolve browser viewport coordinates to an active-sheet cell for host-owned menus and interactions. Returns null outside the cell body.
getActiveSheet Id of the currently visible sheet.
getCellInput Editable snapshot of the cell at a view position on the active sheet, or null when out of bounds.
Editable snapshot of the cell at a view position on the active sheet, or
null when out of bounds. See CellInputSnapshot.
getSelection
setSelection
getTheme Resolved base theme, before zoom scaling.
Resolved base theme, before zoom scaling. The returned object is a copy.
getShortcutLabel Platform-aware label for a bound action, or an empty string when disabled.
setTheme Imperative patch: merge theme into the accumulated base theme.
replaceTheme Option-level replacement: re-run construction-time resolution (DEFAULTTHEME < CSS custom properties < theme) with the new partial.
Option-level replacement: re-run construction-time resolution
(`DEFAULT_THEME < CSS custom properties < theme`) with the new partial.
`undefined` restores the CSS-variable/default resolution. Adapters call
this for their declarative `theme` prop; imperative patching stays on
setTheme.
getEffectiveTheme The effective (post-zoom) theme the renderer is currently painting with.
setReadOnly Update editability without replacing the Grid or clearing session state.
setReadOnly(readOnly: boolean): void;setConfig Reconfigure built-in chrome and keyboard handling without replacing the Grid or clearing selection/history.
Reconfigure built-in chrome and keyboard handling without replacing the Grid or clearing selection/history. Construction-bound GridOptions are not accepted here.
applyTransaction Apply arbitrary patches as one undoable Grid commit.
Apply arbitrary patches as one undoable Grid commit. No-op when read-only.
Use Store.applyTransaction only for low-level writes that intentionally
bypass Grid history and policy.
Examples
] });}See also
exportSnapshot Deterministically export the complete authoritative workbook document.
applyRemoteOperations Apply host-supplied operations without undo history or outgoing dirty state.
applyRemoteOperations(operations: readonly DocumentOp[], options?: RemoteOperationOptions): ApplyTransactionResult;Apply host-supplied operations without undo history or outgoing dirty state. The resulting change event has `source: "remote"`.
defineCellRenderer
aggregate Column aggregate over the active sheet's data.
Column aggregate over the active sheet's data.
Examples
}See also
sortBy Sort the displayed rows by a column (does not mutate stored data).
sortBy(col: number, ascending?: boolean): void;Sort the displayed rows by a column (does not mutate stored data).
Examples
}See also
sortByMulti Multi-key sort of the displayed rows (first key primary; stable).
filterBy Filter the displayed rows to those whose column text contains needle.
filterBy(col: number, needle: string): void;Filter the displayed rows to those whose column text contains needle.
Examples
}See also
setColumnFilter Set or clear (null) one column's filter.
Set or clear (null) one column's filter. All column filters AND together and compose with the active sort and hidden rows.
setSort Persisted multi-key sort of the active sheet.
getColumnFilters Active column filters on the active sheet, keyed by column index.
distinctValues Distinct resolved values of a column in first-seen order.
Distinct resolved values of a column in first-seen order. Defaults to 1,000 values for bounded filter menus; pass 0 to request an uncapped scan.
hideRows Hide the given data rows (composes with filters/sort).
hideRows(rows: readonly number[]): void;showRows Show the given data rows again, or every hidden row when omitted.
showRows(rows?: readonly number[]): void;hideColumns Hide columns through one bulk-safe metadata transaction.
hideColumns(cols?: readonly number[]): void;showColumns Show columns through one bulk-safe metadata transaction.
showColumns(cols?: readonly number[]): void;groupRows Define a collapsible row group over a data-row range (end-inclusive).
groupRows(start: number, end: number): void;ungroupRows Remove a row group (rows become visible if the group was collapsed).
ungroupRows(start: number, end: number): void;setGroupCollapsed Collapse/expand a row group; collapsing hides its rows.
setGroupCollapsed(start: number, collapsed: boolean): void;rowGroups Row groups on the active sheet.
clearView Clear any active sort/filter view.
clearView(): void;undo Undo the last recorded cell edit.
undo(): void;Undo the last recorded cell edit. If the restored data is above the
transaction resource limits, nothing changes: the Grid emits
mutation-rejected and removes that entry, so older edits stay undoable.
Examples
}See also
redo Redo the last undone cell edit.
redo(): void;exportCsv Download the active sheet as CSV.
exportCsv(filename: string): void;Download the active sheet as CSV.
Examples
exportXlsx Download the active sheet through the registered XLSX backend.
exportXlsx(filename: string): Promise<void>;Download the active sheet through the registered XLSX backend.
Examples
}See also
search Find cells matching query; highlights matches, emits search, returns the result.
findNext Move the active match to the next match and scroll it into view.
findPrev Move the active match to the previous match and scroll it into view.
clearSearch Clear the current search and its highlights.
clearSearch(): void;replaceCurrent Replace the active match with replacement, then advance to the next match (re-scanning against the new data).
Replace the active match with `replacement`, then advance to the next match
(re-scanning against the new data). Only literal text/number cells are
eligible; formula and ref cells are skipped (formula source is never
rewritten). Honors the active SearchOptions (matchCase; `wholeCell`
swaps the entire cell). The write flows through the grid's commit path as
one undoable step. No-op when read-only or when there is no active match.
replaceAll Replace every current match in a single undoable transaction (one undo() restores them all), then re-scan.
Replace every current match in a single undoable transaction (one `undo()` restores them all), then re-scan. Formula/ref cells are skipped and not counted. No-op when read-only.
insertRows
insertRows(at: number, count?: number): void;removeRows
removeRows(at: number, count?: number): void;insertColumns
insertColumns(at: number, count?: number): void;removeColumns
removeColumns(at: number, count?: number): void;addSheet Add a sheet with a stable ID and return its actionable transaction outcome.
removeSheet Remove a sheet while preserving at least one visible worksheet.
renameSheet
moveSheet
setSheetVisibility Set host-visible worksheet state; stock UI never offers veryHidden.
setConditionalFormats
setHyperlink
removeHyperlink
getHyperlink
activateHyperlink Validate and emit a host-owned activation event.
Validate and emit a host-owned activation event. External targets are never opened by Sheetwrite; internal navigation occurs only under the explicit policy.
setValidationRule
removeValidationRule
setProtectedRange
removeProtectedRange
setProtectionResolver
setNote
getNote
setOverscan Live-update the render window overscan (row/column positions painted past each edge); undefined restores the default of 6.
setOverscan(overscan?: number): void;setMinColumns Live-update the minimum rendered column count.
setMinColumns(minColumns?: number): void;Live-update the minimum rendered column count. Increasing the minimum silently extends presentation padding; `undefined` restores the default.
highlightCells Draw temporary highlights outside document history.
Draw temporary highlights outside document history. Pass `null` to clear all highlights: `grid.highlightCells(null)`. Per-range `color` wins over the call color. Undo does not clear highlights; use `styleRange` for persistent cell fills.
setPresenceOverlays Replace ephemeral remote-presence overlays; null clears every collaborator.
styleRange Merge style into every cell of range (null clears cell styles) as one undoable transaction.
Merge `style` into every cell of `range` (null clears cell styles) as one
undoable transaction. Styles land in the store and paint in the canvas —
unlike highlightCells, which draws a translucent overlay above it.
beginEdit Open the cell editor at a view cell, optionally seeding text / selecting all.
beginEdit(row: number, col: number, initial?: string, selectAll?: boolean): void;dataEdge Ctrl+Arrow-style jump target: the data-run edge from (row, col) on the moved axis (row for vertical moves, col for horizontal), or null when the store is not columnar.
dataEdge(row: number, col: number, dRow: number, dCol: number): number | null;Ctrl+Arrow-style jump target: the data-run edge from (row, col) on the moved axis (row for vertical moves, col for horizontal), or null when the store is not columnar. Under an active sort/filter view, `row` is a view position and vertical moves return view positions. For hosts building their own keymaps (`config.keyboard`).
setRowHeight Set one row's persistent display height through document history.
setRowHeight(row: number, height: number): void;setColumnWidth Set one column's width via an undoable setColumn patch.
setColumnWidth(col: number, width: number): void;autoFitRows Explicitly resize rows to fit wrapped content; never runs during paint.
autoFitColumns Explicitly resize columns from a bulk worksheet read.
autoFitColumns(cols?: readonly number[]): void;setFrozen Pin the first rows view rows and cols columns; they stay visible while the body scrolls (0 = unfreeze that axis).
setFrozen(rows: number, cols?: number): void;Pin the first `rows` view rows and `cols` columns; they stay visible while the body scrolls (0 = unfreeze that axis). Persisted on the active sheet.
setZoom Content zoom factor (0.5–2): scales row/column geometry and fonts.
setZoom(zoom: number): void;getZoom
getZoom(): number;rendererKind Which renderer is actually active: "worker" when the OffscreenCanvas worker constructed successfully, "canvas" otherwise (including after a renderer-fallback).
rendererKind(): "canvas" | "worker";on
refresh
refresh(): void;destroy
destroy(): void;Declaration
View full TypeScript declaration
export interface Grid { getRuntimeResourceSnapshot( setReadOnly(readOnly: boolean): void; applyRemoteOperations( sortBy(col: number, ascending?: boolean): void; filterBy(col: number, needle: string): void; hideRows(rows: readonly number[]): void; showRows(rows?: readonly number[]): void; hiddenRows(): readonly number[]; hideColumns(cols?: readonly number[]): void; showColumns(cols?: readonly number[]): void; hiddenColumns(): readonly number[]; groupRows(start: number, end: number): void; ungroupRows(start: number, end: number): void; setGroupCollapsed(start: number, collapsed: boolean): void; clearView(): void; undo(): void; redo(): void; exportCsv(filename: string): void; exportXlsx(filename: string): Promise<void>; clearSearch(): void; insertRows(at: number, count?: number): void; removeRows(at: number, count?: number): void; insertColumns(at: number, count?: number): void; removeColumns(at: number, count?: number): void; setSheetVisibility( setProtectionResolver( ): void; setOverscan(overscan?: number): void; setMinColumns(minColumns?: number): void; highlightCells( color?: string, ): void; beginEdit( row: number, col: number, initial?: string, selectAll?: boolean, ): void; dataEdge( row: number, col: number, dRow: number, dCol: number, ): number | null; setRowHeight(row: number, height: number): void; setColumnWidth(col: number, width: number): void; autoFitColumns(cols?: readonly number[]): void; setFrozen(rows: number, cols?: number): void; setZoom(zoom: number): void; getZoom(): number; rendererKind(): "canvas" | "worker"; evt: E, ): () => void; refresh(): void; destroy(): void;}Referenced by
Workspace packages depending on @sheetwrite/vue
@sheetwrite/docs-startdependency
Public exports naming Grid
CellEditorContext@sheetwrite/coreContextMenuItem@sheetwrite/corecreateGrid@sheetwrite/corecreateGridFromSnapshot@sheetwrite/coreGridConfig@sheetwrite/corePresenceCoordinator@sheetwrite/coreRevisionCoordinator@sheetwrite/coreSyncCoordinator@sheetwrite/coreToolbarItem@sheetwrite/coretoXlsxWorkbook@sheetwrite/coreGridController@sheetwrite/coreGridPublicationAdapter@sheetwrite/core- and 17 more