Skip to content

Initial Selection

You can set an initial cell or range selection when the SpreadsheetViewer mounts using the initialSelection prop.

The initialSelection prop accepts an A1-style reference string, optionally prefixed with a sheet name.

You can build a reference programmatically using the re-exported A1Ref class:

import { SpreadsheetViewer, A1Ref } from "@grid-is/mondrian-react";
const ref = new A1Ref(selection, { sheetName: "Summary" });
<SpreadsheetViewer model={model} initialSelection={ref.toString()} />;

The A1-style reference format follows Excel’s standard notation:

  • A1 - Single cell
  • A1:B5 - Range of cells
  • Sheet1!A1 - Cell on a specific sheet
  • Sheet1!A1:B5 - Range on a specific sheet