API reference / Common / Engine types / SpreadsheetSelection
Type Alias: SpreadsheetSelection
type SpreadsheetSelection =
| "none"
| {
cells: {
sheet: SheetId;
anchor: GridCellRef;
focus: GridCellRef;
};
}
| {
columns: {
sheet: SheetId;
anchor: GridColumnId;
focus: GridColumnId;
};
}
| {
rows: {
sheet: SheetId;
anchor: GridRowId;
focus: GridRowId;
};
}
| {
all: {
sheet: SheetId;
};
};The selection of a spreadsheet document's editor — presence state beside the CRDT, never in it (see [Selection]).
A selection sits on one sheet and names its cells, rows and columns by id, so it survives a concurrent reorder and a deleted sheet or track simply stops resolving. It is one of four shapes a grid gesture yields:
Cells— a rectangular block, named by two corners: theanchor(where a press / drag began, Excel's active cell — the keyboard focus an edit types into) and thefocus, its opposite / live corner.Columns/Rows— a range of whole columns / rows (a header press or drag), directedanchor..focuslike a cell block so a Shift-extend holds the anchor and moves the focus.All— the whole sheet (the corner box).
Corners are kept directed (rather than a normalized [GridCellRange]) so a Shift-extend can hold the anchor fixed and move only the focus, exactly as Excel does. Discontiguous (Ctrl-picked) multi-area selection is deferred — every gesture yields one contiguous selection. Mirrors the by-id, presence-only shape of PortableSelection / PresentationSelection.