For the complete documentation index, see llms.txt. This page is also available as Markdown.

Listen to Spreadsheet Editor events

Requirements

These packages are required to use these features in production. Trial keys have unlimited access to all features

Web SDKPackage: Spreadsheet EditorLive demo

Spreadsheet Editor events enable your application to respond to changes and user interactions within the Spreadsheet Editor.

Events are exposed through the SpreadsheetEditorManager class and can be used to detect editor initialization, edit mode changes, sheet updates, cell modifications, selection changes, and formula bar actions. Subscribe to these events to implement custom workflows, synchronize application state, validate data, and extend the editor experience.

Editor events

Editor events provide notifications about the overall Spreadsheet Editor lifecycle and state. For example, these events occur when the editor is initialized and when the editing mode changes.

Initialize the editor

The spreadsheetEditorReady event fires when the editor has finished initializing and is ready for use. Use this when you want to perform editor operations immediately on load.

WebViewer(...)
  .then(instance => {
    const { documentViewer, SpreadsheetEditor } = instance.Core;
    const SpreadsheetEditorEvents = SpreadsheetEditor.SpreadsheetEditorManager.Events;
    const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();

    spreadsheetEditorManager.addEventListener(SpreadsheetEditorEvents.SPREADSHEET_EDITOR_READY, () => {
      spreadsheetEditorManager.setEditMode(SpreadsheetEditor.SpreadsheetEditorEditMode.EDITING);
    });
  });

Detect edit mode changes

The spreadsheetEditorEditModeChanged event fires when the editor changes modes. Use this to detect when the editor changes to view or edit mode.

Worksheet events

Sheet events are triggered when users interact with worksheets or when sheet-level changes occur, such as switching between sheets or modifying worksheet content.

Detect active sheet updates

The activeSheetChanged event fires when the editor has switched to a different sheet.

Track worksheet changes

The sheetChanged event fires when a sheet's state changes, such as renaming, deletion, creation, or visibility. The available options are listed in the SpreadsheetChangedActions definition.

Cell events

Cell events notify your application when cell data or selections change. Use these events to react to data updates, refresh dependent UI elements, or implement validation logic.

Track cell and range updates

The dataChanged event fires when a cell or cell range is modified. Changes can include values, styles, cut or paste, merge or unmerge, and add or remove rows and columns. The DataChangeType type shows all available options.

Detect cell selection changes

The selectionChanged event fires when the editor selects a different cell. The editor will fire an event on initialization to indicate it has selected the top-left cell.

Formula bar events

Formula bar events notify your application when users interact with the formula bar. Use these events to monitor formula input, surface formula information, and provide search suggestions as users build formulas.

Track formula bar inputs

The formulaBarTextChangedEvent event fires when the formula bar text input changes. The following code shows how to listen to the text changed event and log each segment of the formula bar using the getInfo() function.

Access formula information

The formulaHelpEvent event fires when the selection of a formula is confirmed, like =SUM(, and returns the formula name, description, and parameter information. The following code sample shows how to listen to the help event and log the available formula information using the getFormulaInfo() function.

Detect formula searches

The formulaSearchEvent event fires when a user types in the formula bar before confirming a formula. The editor returns a list of formulas that closely match the search query. It must start with an equals sign (=) to trigger the search. The following code sample shows how to listen for the search event and log the results as an array.

Last updated

Was this helpful?