# spreadsheet-editor-protection

> Spreadsheet editor protects sheets and ranges with configurable edit permissions.

**Framework:** vue  **Component:** SpreadsheetEditor  **Variant:** protection

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/vue/spreadsheet-editor-protection.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-spreadsheet
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/spreadsheet-editor-protection/SpreadSheetEditor.vue

```vue
<template>
  <div class="control-section">
    <div id="spreadsheet-protect-sheet">
        <ejs-spreadsheet  ref="spreadsheet" password="spreadsheet" :openUrl="openUrl" :saveUrl="saveUrl" :allowOpen="false" :allowSave="false" :created="created" :beforeCellRender="beforeCellRender">
            <e-sheets>
                <e-sheet isProtected="true" name="EMI Calculator">
                    <e-rows>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Home Loan Calculator" :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Loan Amount:"></e-cell>
                                <e-cell value="100000" format="$#,##0.00"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Interest Rate:"></e-cell>
                                <e-cell value="0.08" format="$#,##0.00"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Periods (terms in year):"></e-cell>
                                <e-cell value="1"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Start Date:"></e-cell>
                                <e-cell value="03-03-2020"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Loan EMI:"></e-cell>
                                <e-cell value="8698.84" format="$#,##0.00"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Number of Payments:"></e-cell>
                                <e-cell value="12"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row height:45>
                            <e-cells>
                                <e-cell index=1 value="Total Repayment Amount:"></e-cell>
                                <e-cell value="104386.11" format="$#,##0.00"></e-cell>
                            </e-cells>
                        </e-row>
                        <e-row>
                            <e-cells>
                                <e-cell index=1 value="Total Interest Amount:"></e-cell>
                                <e-cell value="4386.11" format="$#,##0.00"></e-cell>
                            </e-cells>
                        </e-row>
                    </e-rows>
                    <e-columns>
                        <e-column index=1 :width=190></e-column>
                        <e-column :width=100></e-column>
                    </e-columns>
                </e-sheet>
                <e-sheet isProtected="true" name="EMI Schedule">
                    <e-ranges>
                        <e-range :dataSource="dataSource"></e-range>
                    </e-ranges>
                    <e-rows>
                        <e-row>
                            <e-cells>
                                <e-cell :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                                <e-cell :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                                <e-cell :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                                <e-cell :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                                <e-cell :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                                <e-cell :style="{ textAlign: 'center', fontWeight: 'bold' }"></e-cell>
                            </e-cells>
                        </e-row>
                    </e-rows>
                    <e-columns>
                            <e-column index=1 :width=110></e-column>
                            <e-column :width=85></e-column>
                            <e-column :width=85></e-column>
                            <e-column :width=80></e-column>
                            <e-column :width=90></e-column>
                    </e-columns>
                </e-sheet>
            </e-sheets>
        </ejs-spreadsheet>
    </div>
  </div>
</template>

<script>
import { SpreadsheetComponent, SheetDirective, SheetsDirective, RangeDirective, RangesDirective, RowDirective, RowsDirective, CellDirective, CellsDirective, ColumnDirective, ColumnsDirective } from "@syncfusion/ej2-vue-spreadsheet";
import { emiScheduleData } from '../datasource/spreadsheet-editor-data';

export default {
   components: {
    'ejs-spreadsheet': SpreadsheetComponent,
    'e-sheet': SheetDirective,
    'e-sheets': SheetsDirective,
    'e-range': RangeDirective,
    'e-ranges': RangesDirective,
    'e-cell': CellDirective,
    'e-cells': CellsDirective,
    'e-row': RowDirective,
    'e-rows': RowsDirective,
    'e-column': ColumnDirective,
    'e-columns': ColumnsDirective
   },
   data: () => {
    return {
        dataSource: emiScheduleData,
        openUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/open',
        saveUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/save'
    }
  },
  methods: {
    created: function() {
        var spreadsheet = this.$refs.spreadsheet;
        spreadsheet.numberFormat('$#,##0.00', 'EMI Schedule!C2:F6');
        spreadsheet.numberFormat('m/d/yyyy', 'EMI Calculator!C5:C5');
        spreadsheet.numberFormat('m/d/yyyy', 'EMI Schedule!B2:B6');
    },
    beforeCellRender: function(args) {
        var spreadsheet = this.$refs.spreadsheet;
        if (args.address === "B1" && spreadsheet.ej2Instances.sheets[spreadsheet.ej2Instances.activeSheetIndex].name === 'EMI Calculator') {
            (args.element).colSpan = 2;
        }
    }
}
}
</script>
```
