New to Kendo UI for Vue? Start a free 30-day trial

Methods

Updated on Nov 25, 2026

The Kendo UI for Vue Spreadsheet exposes methods that let you control the component and its data programmatically. You can read and change the content of the cells, execute commands, switch between sheets, and save or load the workbook.

Accessing the Methods

To call the methods, get a reference to the Spreadsheet by using a template ref:

vue
<template>
    <Spreadsheet ref="spreadsheetRef" :default-props="{ sheets: sheets }" />
</template>

<script setup>
import { ref } from 'vue';
import { Spreadsheet } from '@progress/kendo-vue-spreadsheet';

const spreadsheetRef = ref(null);
</script>

The reference is available after the component is mounted.

Available Methods

MethodDescription
activeSheet(sheet?)Returns the active sheet. When you pass a sheet, the method makes it the active one.
sheets()Returns an array with all the sheets in the workbook.
executeCommand(options)Executes a command, such as PropertyChangeCommand, SortCommand, FilterCommand, or EditValidationCommand, against the selected cell or range.
toJSON()Returns the workbook as a JSON object.
saveJSON()Returns a promise that resolves with the workbook as a JSON object. Unlike toJSON(), it also saves the embedded images.
fromJSON(json)Loads a workbook from a JSON object.
saveAsExcel(options)Exports the workbook to an Excel file.
fromFile(file)Loads a workbook from an Excel (.xlsx) file.
refresh()Re-renders the Spreadsheet.
getInstance()Returns the underlying Spreadsheet widget instance.
getView()Returns the view of the Spreadsheet.
getWorkbook()Returns the workbook of the Spreadsheet.

For more details on the methods and their parameters, see the Spreadsheet API reference.

Working with Sheets and Ranges

The activeSheet() and sheets() methods return sheet objects. A sheet provides the range() method, which returns a range for a cell or a group of cells, for example, sheet.range('A1') or sheet.range('B2:D10').

A range exposes methods that read and write the cell data and formatting. Most of them work as a getter when called without an argument, and as a setter when called with one:

MethodDescription
value()Gets or sets the value of the cells.
formula()Gets or sets the formula of the cells.
format()Gets or sets the number format of the cells.
background() and color()Get or set the background and the text color.
bold() and italic()Get or set the font style.
fontFamily() and fontSize()Get or set the font.
textAlign() and verticalAlign()Get or set the alignment.
enable()Gets or sets whether the cells are enabled. See Disabled Cells.
link()Gets or sets the hyperlink of the cells.
clear()Clears the content, the formatting, or both.
select()Selects the range.
forEachCell(callback)Calls the callback for every cell in the range.

The following example demonstrates how to use the methods to highlight cells, change the formatting of the selection, and read the sheets and the values of the formulas.

Example
View Source
Loading ...

Executing Commands

The executeCommand method runs the same commands that the toolbar tools use. It accepts an object with the following fields:

  • command—The name of the command.
  • options—The options of the command. When the command does not specify an operatingRange, it applies to the current selection.
js
spreadsheetRef.value.executeCommand({
    command: 'PropertyChangeCommand',
    options: { property: 'bold', value: true }
});

Saving and Loading

  • To save the workbook, use toJSON() or saveJSON(), or export to Excel by using saveAsExcel().
  • To restore the workbook, use fromJSON() or fromFile().

For examples, see Import and Export.