Editing in Vue Spreadsheet component

16 Mar 20237 minutes to read

You can edit the contents of a cell directly in the cell or by typing in the formula bar. By default, the editing feature is enabled in the spreadsheet. Use the allowEditing property to enable or disable the editing feature.

Edit cell

You can start editing by one of the following ways,

  • Double click a cell to start the edit mode.
  • Press F2 key to edit the active cell.
  • Use formula bar to perform editing.
  • Use BACKSPACE or SPACE key to clear the cell content and start the edit mode.
  • Using the startEdit method.

Save cell

If the cell is in editable state, you can save the edited cell by one of the following ways,

  • Perform mouse click on any other cell rather than the current editing cell.
  • Press Enter or Tab keys to save the edited cell content.
  • Using the endEdit method.

Cancel editing

To cancel the editing without saving the changes, you can use one of the following ways,

  • Press ESCAPE key, this will remove the editable state and update the unchanged cell content.
  • Using the closeEdit method.

The following sample shows how to prevent the editing and cell save. Here E column prevent the editing by using cancel argument as true in cellEdit event. In D column, prevent saving the edited changes by using cancel argument as true in beforeCellSave and use closeEdit method in spreadsheet.

  <ejs-spreadsheet ref="spreadsheet" :created="created" :showFormulaBar="false" :cellEdit="cellEdit" :beforeCellSave="beforeCellSave">
            <e-sheet selectedRange="E11">
                      <e-range :dataSource="dataSource"></e-range>
                      <e-column :width=120></e-column>
                      <e-column :width=180></e-column>
                      <e-column :width=100></e-column>
                      <e-column :width=120></e-column>
                      <e-column :width=120></e-column>
                      <e-row index="10">
                      <e-cell index="3" value="Total Amount:" style="fontStyle"></e-cell>
                      <e-cell formula="=SUM(E2:E10)"></e-cell>

import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
import { data } from './data.js';
export default {
   data: () => {
    return {
      dataSource: data,
       fontStyle: { fontWeight: 'bold' }
  methods: {
  created: function () {
      var spreadsheet = this.$refs.spreadsheet;
     spreadsheet.cellFormat({ fontWeight: 'bold', textAlign: 'center' }, 'A1:E1');
        spreadsheet.cellFormat({ textAlign: 'center' }, 'A2:A10');
        spreadsheet.cellFormat({ textAlign: 'center' }, 'C2:C10');
        spreadsheet.numberFormat('$#,##0.00', 'D2:D10');
        spreadsheet.numberFormat('$#,##0.00', 'E2:E11');
      cellEdit: function (args) {
       // Preventing the editing in 5th(Amount) column.
        if (args.address.includes('E')) { args.cancel = true; }
    beforeCellSave: function (args) {
      var spreadsheet = this.$refs.spreadsheet;
         // Prevent saving the edited changes in 4th(Rate) column.
        if (args.address.includes('D')) {
            args.cancel = true;
            // Manually removes the editable state without saving the changes. Use `endEdit` method if you want to save the changes.
 @import "../node_modules/@syncfusion/ej2-vue-spreadsheet/styles/material.css";
 @import '../node_modules/@syncfusion/ej2-base/styles/material.css';  
 @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';  
 @import '../node_modules/@syncfusion/ej2-dropdowns/styles/material.css';  
 @import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';  
 @import '../node_modules/@syncfusion/ej2-navigations/styles/material.css';
 @import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
 @import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css';
 @import '../node_modules/@syncfusion/ej2-grids/styles/material.css';
 @import "../node_modules/@syncfusion/ej2-spreadsheet/styles/material.css";


  • Text overflow in cells is not supported in Editing.


You can refer to our Vue Spreadsheet feature tour page for its groundbreaking feature representations. You can also explore our Vue Spreadsheet example to knows how to present and manipulate data.

See Also