Worksheet
Overview
Worksheet is a class in Aspose.Cells FOSS for Python.
Represents a single worksheet in an Excel workbook.
This class provides 30 methods for working with Worksheet objects in Python programs.
Available methods include: ClearPrintArea, SetPrintArea, __init__, activate, calculate_formula, clear_print_area, clear_tab_color, copy, delete, get_page_margins, get_page_orientation, get_paper_size, and 18 additional methods.
All exported members are accessible to any Python application after installing the Aspose.Cells FOSS for Python package.
Properties: auto_filter, cells, charts, conditional_formats, data_validations, horizontal_page_breaks, and 15 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
name | `` | Read | Gets or sets the name of the worksheet. |
cells | `` | Read | Gets the Cells collection for this worksheet. |
visible | `` | Read | Gets or sets the visibility state of the worksheet. |
tab_color | `` | Read | Gets or sets the tab color of the worksheet. |
auto_filter | `` | Read | Gets the AutoFilter object for this worksheet. |
conditional_formats | `` | Read | Gets the collection of conditional formats for this worksheet. |
data_validations | `` | Read | Gets the collection of data validations for this worksheet. |
hyperlinks | `` | Read | Gets the collection of hyperlinks for this worksheet. |
charts | `` | Read | Gets the collection of charts for this worksheet. |
shapes | `` | Read | Gets the collection of drawing shapes for this worksheet. |
tables | `` | Read | Gets the collection of structured tables (ListObjects) for this worksheet. |
sparkline_groups | `` | Read | Gets the collection of sparkline groups for this worksheet. |
pictures | `` | Read | Gets the collection of pictures for this worksheet. |
protection | `` | Read | Gets the protection settings for this worksheet. |
page_setup | `` | Read | Gets the page setup settings for this worksheet. |
page_margins | `` | Read | Gets the page margins for this worksheet. |
properties | `` | Read | Gets the worksheet properties. |
horizontal_page_breaks | `` | Read | Gets manual horizontal page break collection. |
vertical_page_breaks | `` | Read | Gets manual vertical page break collection. |
merged_cells | `` | Read | Gets merged cell ranges in A1 notation. |
print_area | `` | Read | Gets or sets print area in A1 notation. |
Methods
| Signature | Description |
|---|---|
__init__(name) | Initializes a new instance of the Worksheet class. |
rename(new_name) | Renames the worksheet. |
set_visibility(value) | Set worksheet visibility. |
get_visibility() | Return current worksheet visibility (True, False, or ‘veryHidden’). |
set_tab_color(color) | Set the worksheet tab color. |
get_tab_color() | Return the worksheet tab color (8-char AARRGGBB hex) or None. |
clear_tab_color() | Clear the worksheet tab color. |
set_page_orientation(orientation) | Set page orientation. |
get_page_orientation() | Return the page orientation (‘portrait’, ’landscape’, or None). |
set_paper_size(paper_size) | Set the paper size (integer code, e.g. |
get_paper_size() | Return the paper size integer code. |
set_page_margins(left, right, top, bottom, header, footer) | Set page margins (in inches). |
get_page_margins() | Return a copy of the page margins dict. |
set_fit_to_pages(width, height) | Set fit-to-pages: width and height are page counts (0 = auto). |
set_print_scale(scale) | Set print scale percentage (10–400). |
set_print_area(print_area) | Sets the worksheet print area. |
clear_print_area() | Clears the worksheet print area. |
SetPrintArea(print_area) | |
ClearPrintArea() | |
is_protected() | Checks if the worksheet is protected. |
protect(password, format_cells, format_columns, format_rows, insert_columns, insert_rows, delete_columns, delete_rows, sort, auto_filter, insert_hyperlinks, pivot_tables, select_locked_cells, select_unlocked_cells, objects, scenarios) | Protects the worksheet with optional password and protection options. |
unprotect(password) | Unprotects the worksheet. |
set_view(zoom, show_grid_lines, show_row_col_headers) | Sets view options for the worksheet. |
copy(name) | Creates a copy of the worksheet. |
delete() | Deletes the worksheet from the workbook. |
move(index) | Moves the worksheet to the specified position in the workbook. |
select() | Selects the worksheet. |
activate() | Activates the worksheet (makes it the active worksheet). |
calculate_formula() | Calculates formulas in the worksheet. |
get_range(start_cell, end_cell) | Gets a range of cells. |