# spreadsheet-editor-conditional-formatting

> Spreadsheet editor with conditional formatting rules applied to data ranges.

**Framework:** vue  **Component:** SpreadsheetEditor  **Variant:** conditional-formatting

## 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-conditional-formatting.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-conditional-formatting/SpreadSheetEditor.vue

```vue
<template>
  <div class="control-section">
    <div id="spreadsheet-conditional-formatting">
        <ejs-spreadsheet ref="spreadsheet" :openUrl="openUrl" :saveUrl="saveUrl" :created="created">
            <e-sheets>
                <e-sheet :name="InventoryList">
                    <e-rows>
                        <e-row :height="height">
                            <e-cells>
                                <e-cell index=1 value="Inventory List"></e-cell>
                            </e-cells>
                        </e-row>
                    </e-rows>
                <e-ranges>
                        <e-range :dataSource="dataSource" startCell="A2" ></e-range>
                </e-ranges>
                <e-conditionalformats>
                    <e-conditionalformat type="GYRColorScale" range="C3:C7" ></e-conditionalformat>
                    <e-conditionalformat type="LessThan" cFColor="RedFT" value="8-8-2019" range="G3:G7"></e-conditionalformat>
                </e-conditionalformats>
                    <e-columns>
                        <e-column :width=100></e-column>
                        <e-column :width=158></e-column>
                        <e-column :width=72></e-column>
                        <e-column :width=113></e-column>
                        <e-column :width=113></e-column>
                        <e-column :width=77></e-column>
                        <e-column :width=97></e-column>
                        <e-column :width=73></e-column>
                    </e-columns>
                </e-sheet>
            </e-sheets>
        </ejs-spreadsheet>
    </div>
  </div>
</template>

<script>
import { SpreadsheetComponent, SheetsDirective, SheetDirective, ColumnsDirective,
ColumnDirective, RowDirective, RowsDirective, CellsDirective, CellDirective,
ConditionalFormatsDirective, ConditionalFormatDirective, RangeDirective,
 RangesDirective, getFormatFromType } from '@syncfusion/ej2-vue-spreadsheet';
import { inventoryListData } from '../datasource/spreadsheet-editor-data';

export default {
   components: {
    'ejs-spreadsheet': SpreadsheetComponent,
    'e-sheet': SheetDirective,
    'e-sheets': SheetsDirective,
    'e-column': ColumnDirective,
    'e-columns': ColumnsDirective,
    'e-row': RowDirective,
    'e-rows': RowsDirective,
    'e-cell': CellDirective,
    'e-cells': CellsDirective,
    'e-conditionalformat': ConditionalFormatDirective,
    'e-conditionalformats': ConditionalFormatsDirective,
    'e-range': RangeDirective,
    'e-ranges': RangesDirective
   },
   data: () => {
    return {
        height: 30,
        InventoryList: 'Inventory List',
        dataSource: inventoryListData,
         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 currencyFormat = '$#,##0.00';
        var spreadsheet = this.$refs.spreadsheet;
            spreadsheet.merge('A1:H1');
            spreadsheet.cellFormat({ fontWeight: 'bold', textAlign: 'center' }, 'A2:H2');
            spreadsheet.cellFormat({ fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle', fontSize: '13pt' }, 'A1:H1');
            spreadsheet.numberFormat(currencyFormat, 'D3:D7');
            spreadsheet.numberFormat(currencyFormat, 'E3:E7');
            spreadsheet.numberFormat(currencyFormat, 'F3:F7');
            spreadsheet.numberFormat('m/d/yyyy', 'G3:G7');
            spreadsheet.conditionalFormat({ type: 'BlueDataBar',  range: 'D3:D7' });
            spreadsheet.conditionalFormat({ type: 'GreenDataBar', range: 'E3:E7' });
            spreadsheet.conditionalFormat({ type: 'ThreeStars',   range: 'H3:H7' });
            spreadsheet.conditionalFormat({ type: 'Top10Items',   value:'1', format:{ style:{ color: '#ffffff', backgroundColor: '#009999', fontWeight: 'bold'}}, range: 'F3:F7' });
            spreadsheet.conditionalFormat({ type: 'Bottom10Items',value:'1', format:{ style:{ color: '#ffffff', backgroundColor: '#c68d53', fontWeight: 'bold'}}, range: 'F3:F7' });
            }
        }
}
</script>
```
