Workbook
Overview
Workbook is a class in Aspose.Cells FOSS for Python.
Represents an Excel workbook.
This class provides 18 methods for working with Workbook objects in Python programs.
Available methods include: __init__, add_worksheet, copy_worksheet, create_worksheet, get_active_worksheet, get_worksheet, get_worksheet_by_index, get_worksheet_by_name, is_protected, load_csv, protect, remove_worksheet, and 6 additional methods.
All exported members are accessible to any Python application after installing the Aspose.Cells FOSS for Python package.
Properties: document_properties, file_path, properties, protection, worksheets.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
worksheets | `` | Read | Gets collection of worksheets in the workbook. |
file_path | `` | Read | Gets the file path of the workbook. |
properties | `` | Read | Gets workbook properties. |
document_properties | `` | Read | Gets document properties of the workbook. |
protection | `` | Read | Return a dict with the current workbook protection settings. |
Methods
| Signature | Description |
|---|---|
__init__(file_path, password) | Initializes a new instance of Workbook class. |
add_worksheet(name) | Adds a new worksheet to the workbook. |
get_worksheet(index_or_name) | Gets a worksheet by index or name. |
remove_worksheet(index_or_name) | Removes a worksheet from the workbook. |
unprotect(password) | Remove workbook structure/window protection. |
create_worksheet(name) | Create and add a new worksheet. |
get_worksheet_by_name(name) | Return the worksheet with the given name, or None if not found. |
get_worksheet_by_index(index) | Return the worksheet at the given 0-based index, or None if out of range. |
get_active_worksheet() | Return the currently active worksheet. |
set_active_worksheet(index_or_name_or_ws) | Set the active worksheet by index, name, or Worksheet object. |
copy_worksheet(index_or_name_or_ws) | Copy a worksheet and append the copy to the workbook. |
protect(password, lock_structure, lock_windows) | Protect the workbook structure/windows with an optional password. |
is_protected() | Return True if the workbook has structure or window protection enabled. |
save(file_path, save_format, options, password, encryption_params) | Saves the workbook to a file. |
save_as_csv(file_path, options) | Saves the workbook to a CSV file. |
load_csv(file_path, options) | Loads data from a CSV file into the workbook. |
save_as_markdown(file_path, options) | Saves the workbook to a Markdown file. |
save_as_json(file_path, options) | Saves the workbook to a JSON file. |