Workbook

Overview

Workbook is a class in Aspose.Cells for Python.

Represents an Excel workbook.

Properties

NameTypeAccessDescription
worksheets``ReadProvides access to the collection of worksheets in the workbook
file_path``ReadHolds the file system path of the workbook
properties``ReadContains workbook-level properties such as author and title
document_properties``ReadExposes document metadata properties of the workbook
protection``ReadRepresents the workbook’s protection settings

Methods

SignatureDescription
__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.