The onChange callback fires whenever the user interacts with the spreadsheet — selecting cells, switching sheets, editing data, and structural changes like inserting rows or columns.
All events include a type discriminator and a timestamp (Unix milliseconds). Operation events also include sheetName.
import { SpreadsheetEditor } from " @grid-is/editor-react " ;
import type { EditorEvent } from " @grid-is/editor-react " ;
const handleChange = ( event : EditorEvent ) => {
console . log ( " Selected: " , event . selection ) ;
console . log ( " Switched to: " , event . sheetName ) ;
console . log ( " Wrote: " , event . cellId , " = " , event . value ) ;
// ... handle other event types
return < SpreadsheetEditor model = { model } onChange = { handleChange } /> ;
Type
Key fields
Description
selection-change
selection
User moved selection to a different cell or range
sheet-change
sheetName, previousSheetName
User switched sheet tabs
Type
Key fields
Description
write-cell
cellId, value
Cell value changed
clear-cells
range
Cell contents cleared
format-cells
range, format
Cell formatting changed
paste
range
Content pasted
fill
sourceRange, targetRange
Cells filled (drag to fill)
Type
Key fields
Description
insert-row
row, direction
Row inserted above or below
insert-column
column, direction
Column inserted left or right
delete-rows
startRow, count
Rows deleted
delete-columns
startColumn, count
Columns deleted
resize-row
row, height
Row height changed
resize-column
column, width
Column width changed
Type
Key fields
Description
move-cells
fromRange, toRange
Cells moved
move-rows
fromRange, toRange
Rows moved
move-columns
fromRange, toRange
Columns moved
Type
Key fields
Description
add-sheet
sheetName
New sheet added
delete-sheet
sheetName
Sheet deleted
rename-sheet
oldName, newName
Sheet renamed
// Navigation events only (selection + sheet switching)
type ViewerEvent = SelectionChangeEvent | SheetChangeEvent ;
// All events including data operations
type EditorEvent = ViewerEvent | WriteCellEvent | PasteEvent | ClearCellsEvent | ...;