---
title: "SpreadsheetEditor"
canonical_url: "https://www.nutrient.io/api/python/editors/spreadsheet-editor/"
md_url: "https://www.nutrient.io/api/python/editors/spreadsheet-editor.md"
last_updated: "2026-09-02T09:34:35.870Z"
description: "Provides specialized editing capabilities for spreadsheet documents. Supports template-based document generation and manipulation of OpenXML Excel documents."
---

Provides specialized editing capabilities for spreadsheet documents. Supports template-based document generation and manipulation of OpenXML Excel documents.

```python

from nutrient_sdk import SpreadsheetEditor

```

## Construction

`SpreadsheetEditor` cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.

## Class Methods

### edit

```python

@classmethod
def edit(cls, document: Document) -> SpreadsheetEditor

```

Creates a new SpreadsheetEditor instance and begins editing the specified document.

**Parameters:**

| Name       | Type                                | Description           |
| ---------- | ----------------------------------- | --------------------- |
| `document` | [`Document`](/api/python/document/) | The document to edit. |

**Returns:** [`SpreadsheetEditor`](/api/python/editors/spreadsheet-editor/) - A new SpreadsheetEditor instance for editing the document.

---

## Methods

### apply_template_model

```python

def apply_template_model(self, json_template: str) -> None

```

Applies a template model to the spreadsheet document from a JSON string.

**Parameters:**

| Name            | Type  | Description                                         |
| --------------- | ----- | --------------------------------------------------- |
| `json_template` | `str` | The JSON string containing the template model data. |

---

### close

```python

def close(self) -> None

```

Closes the editor and releases all associated resources.

---

### save

```python

def save(self) -> None

```

Saves the current changes made in the editor.

---

### save_as

```python

def save_as(self, path: str) -> None

```

Saves the current changes to a file at the specified path.

**Parameters:**

| Name   | Type  | Description                                     |
| ------ | ----- | ----------------------------------------------- |
| `path` | `str` | The file path where the document will be saved. |

---

### save_with_model_as

```python

def save_with_model_as(self, path: str) -> None

```

Saves the spreadsheet document with the applied template model to a file.

**Parameters:**

| Name   | Type  | Description                                               |
| ------ | ----- | --------------------------------------------------------- |
| `path` | `str` | The file path where the processed document will be saved. |

---

## Context manager

`SpreadsheetEditor` supports the context manager protocol. Use `with` to ensure native resources are released automatically:

```python

with SpreadsheetEditor.edit(...) as spreadsheet_editor:
    #... use spreadsheet_editor...

    pass  # closed automatically on exit

```

Or close explicitly:

```python

spreadsheet_editor = SpreadsheetEditor.edit(...)
try:
    #... use spreadsheet_editor...

    pass
finally:
    spreadsheet_editor.close()

```

---

## Related pages

- [All public classes import directly from the top-level package:](/api/python/editors.md)
- [Pdf Editor](/api/python/editors/pdf-editor.md)
- [Presentation Editor](/api/python/editors/presentation-editor.md)
- [Word Editor](/api/python/editors/word-editor.md)

