New to Kendo UI for AngularStart a free 30-day trial

Angular Spreadsheet Disabled Cells

Updated on Mar 26, 2026

The Spreadsheet allows you to protect specific cells from being edited by disabling them. When you export a Spreadsheet with disabled cells to Excel, the disabled cells become locked protected cells. Disabled cells are useful for locking auto-generated values, computed formulas, or protected reference data while keeping the rest of the Spreadsheet fully editable.

The following example demonstrates disabled cells in a Q1 Sales Performance Report. The Rep ID column and all formula-based cells are disabled by default. The Spreadsheet will display an error dialog when pasting into a disabled cell or dragging the fill handle over a disabled range.

Change Theme
Theme
Loading ...

Configuring Cell Protection

To disable a cell, set the enable property of the Cell object to false. A disabled cell retains its value and formatting, but the user cannot edit it.

typescript
public sheets: SheetDescriptor[] = [{
    name: 'Invoice',
    rows: [{
        cells: [
            { value: 216321, textAlign: 'center', enable: false },
            { value: 'Calzone' }
        ]
    }]
}];

You can also toggle protection at runtime by accessing the underlying SpreadsheetWidget instance of the SpreadsheetComponent and calling the enable() method of the Range to read and invert the current state.

typescript
@ViewChild('spreadsheet') private spreadsheetRef: SpreadsheetComponent;

public toggleDisabled(disabled: boolean): void {
    const sheet = this.spreadsheetRef.spreadsheetWidget.activeSheet() as any;
    const ranges = ['A2:A11', 'E2:E11', 'F2:F11'];

    ranges.forEach(rangeRef => {
        const range = sheet.range(rangeRef);
        let enabled = range.enable();

        if (enabled === null) {
            enabled = true;
        }

        range.enable(!enabled);
    });
}

Customizing Error Messages for Disabled Cells

The Spreadsheet displays a built-in error dialog when a user attempts to edit a disabled cell. For example, pasting content into a disabled cell or dragging the fill handle over a disabled range triggers the error dialog.

You can customize the default error messages using the <kendo-spreadsheet-messages> component. The following properties control the messages in the error dialog when a user attempts to modify a disabled cell:

  • cannotModifyDisabled—Sets the message text for the dialog that appears when the user tries to edit a single disabled cell.
  • rangeDisabled—Sets the message text for the dialog that appears when the edited range contains one or more disabled cells.
html
<kendo-spreadsheet [sheets]="sheets">
    <kendo-spreadsheet-messages
        cannotModifyDisabled="This cell is protected and cannot be modified."
        rangeDisabled="The selected range contains one or more protected cells."
    ></kendo-spreadsheet-messages>
</kendo-spreadsheet>

See Also