This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/python/editors/spreadsheet-editor.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. SpreadsheetEditor

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

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

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

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

Parameters:

NameTypeDescription
documentDocumentThe document to edit.

Returns: SpreadsheetEditor - A new SpreadsheetEditor instance for editing the document.


Methods

apply_template_model

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

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

Parameters:

NameTypeDescription
json_templatestrThe JSON string containing the template model data.

close

def close(self) -> None

Closes the editor and releases all associated resources.


save

def save(self) -> None

Saves the current changes made in the editor.


save_as

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

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

Parameters:

NameTypeDescription
pathstrThe file path where the document will be saved.

save_with_model_as

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

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

Parameters:

NameTypeDescription
pathstrThe 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:

with SpreadsheetEditor.edit(...) as spreadsheet_editor:
# ... use spreadsheet_editor ...
pass # closed automatically on exit

Or close explicitly:

spreadsheet_editor = SpreadsheetEditor.edit(...)
try:
# ... use spreadsheet_editor ...
pass
finally:
spreadsheet_editor.close()