API Reference

This section contains the automatically generated API documentation extracted from the source code.

pyopenxlsx — complete Python bindings for OpenXLSX-NX.

API layers

Recommended high-level API (stable, Pythonic):

Workbook, Worksheet, Cell, Range, Column, load_workbook,
Font, Fill, Border, Side, Alignment, Style, Protection,
Table, Formula, FormulaEngine, CalculationEngine,
DataValidation, DataValidations, PageMargins, PrintOptions, PageSetup,
chart helpers (Chart, chart_type, add_chart), pivot builders,
conditional_formatting builders, StreamWriter / StreamReader,
DefinedNames / link_cell

Advanced / native surface (pyopenxlsx._openxlsx and star-export of XL* types): 1:1 with the C++ OpenXLSX-NX API. Prefer for charts/pivot options enums and low-level rule objects; names may track upstream C++ more closely than the high-level façade.

Internal modules named _ws_* are Worksheet mixins and are not part of the public API.

class pyopenxlsx.Alignment(horizontal=None, vertical=None, wrap_text=False, indent=0, text_rotation=0, shrink_to_fit=False)[source]

Bases: object

horizontal()[source]
Return type:

Optional[XLAlignmentStyle]

indent()[source]
Return type:

int

set_horizontal(value)[source]
Return type:

None

set_indent(value)[source]
Return type:

None

set_shrink_to_fit(value)[source]
Return type:

None

set_text_rotation(value)[source]
Return type:

None

set_vertical(value)[source]
Return type:

None

set_wrap_text(value)[source]
Return type:

None

shrink_to_fit()[source]
Return type:

bool

text_rotation()[source]
Return type:

int

vertical()[source]
Return type:

Optional[XLAlignmentStyle]

wrap_text()[source]
Return type:

bool

class pyopenxlsx.Border(left=None, right=None, top=None, bottom=None, diagonal=None, outline=None)[source]

Bases: object

bottom()[source]
Return type:

Side

diagonal()[source]
Return type:

Side

left()[source]
Return type:

Side

right()[source]
Return type:

Side

set_bottom(style, color)[source]
Return type:

None

set_diagonal(style, color)[source]
Return type:

None

set_left(style, color)[source]
Return type:

None

set_right(style, color)[source]
Return type:

None

set_top(style, color)[source]
Return type:

None

top()[source]
Return type:

Side

class pyopenxlsx.CalculationEngine(target, options=None)[source]

Bases: object

Sheet- or workbook-scoped formula recalculation with dependency tracking.

calc_cell_value(a1)[source]
Return type:

Any

property dirty_count: int
property formula_count: int
mark_dirty(a1, propagate=True)[source]
Return type:

None

property raw: XLCalculationEngine
rebuild()[source]
Return type:

None

recalculate()[source]
Return type:

int

recalculate_all()[source]
Return type:

int

recalculate_inputs(values)[source]

Set multiple input cells then recalculate.

Parameters:

values (dict) – Mapping of A1 address → value

Return type:

int

Returns:

Number of cells recalculated (engine-dependent).

set_input_value(a1, value)[source]
Return type:

None

class pyopenxlsx.Cell(raw_cell, worksheet=None)[source]

Bases: object

Represents an Excel cell.

OPTIMIZATION PRINCIPLE: Direct reference model is used for _worksheet_val instead of weakref. Because the Worksheet keeps a WeakValueDictionary _cells cache of Cell objects, there is no strong reference cycle between Worksheet and Cell. This eliminates the allocation of 2 weakref objects for every Cell creation, massively improving performance in loops and preventing GC thrashing.

property alignment
property border
property comment
property fill
property font
property formula
property is_date

Returns True if the cell is formatted as a date/time. Requires workbook to be passed to Cell constructor.

property style
property style_index
property value
class pyopenxlsx.Chart(native_chart)[source]

Bases: object

Fluent wrapper around a native XLChart.

Does not own placement; obtain via add_chart() or wrap an existing chart with Chart(native).

bubble_series(x_ref, y_ref, size_ref, *, name='')[source]
Return type:

Chart

chart_area_color(hex_rgb)[source]
Return type:

Chart

data_labels(*, value=True, category=False, percent=False)[source]
Return type:

Chart

data_table(show=True, *, keys=False)[source]
Return type:

Chart

gap_width(percent)[source]
Return type:

Chart

hole_size(percent)[source]
Return type:

Chart

legend(position='right')[source]
Return type:

Chart

overlap(percent)[source]
Return type:

Chart

property raw: Any

Underlying native chart object.

rotation(x, y, perspective=30)[source]
Return type:

Chart

series(values_ref, *, name='', categories_ref='', series_type=None, secondary_axis=False)[source]

Add a series from A1-style references.

Return type:

Chart

series_many(series_list, *, categories_ref='')[source]

Add multiple series.

Each item is either a values ref string, or a mapping/tuple:

"Sheet1!$B$2:$B$4"
("Sheet1!$B$2:$B$4", "Sales")
{"values": "...", "name": "Sales", "categories": "..."}
Return type:

Chart

style(style_id)[source]
Return type:

Chart

title(text)[source]
Return type:

Chart

x_axis()[source]
Return type:

Any

y_axis()[source]
Return type:

Any

class pyopenxlsx.Column(raw_column, worksheet=None)[source]

Bases: object

Represents an Excel column.

Uses weak references to avoid circular references with Worksheet/Workbook.

property hidden
property style_index
property width
class pyopenxlsx.DataValidation(raw_dv, worksheet=None)[source]

Bases: object

Represents an Excel data validation rule.

add_cell(cell_ref)[source]

Add a cell to the validation range.

Return type:

None

add_range(range_ref)[source]

Add a range to the validation.

Return type:

None

property allow_blank

Whether blank values are allowed.

property error

The error message.

property error_style

Get the error style.

property error_title

The title of the error message.

property formula1

The first formula for the validation.

property formula2

The second formula for the validation.

property ime_mode

Get the IME mode.

property operator

Get the validation operator.

property prompt

The prompt message.

property prompt_title

The title of the prompt message.

set_error(title, message, style='stop')[source]

Set the error message title, message and style. Style can be ‘stop’, ‘warning’, or ‘information’.

Return type:

None

set_list(items)[source]

Set a list of allowed values.

Return type:

None

set_prompt(title, message)[source]

Set the input prompt title and message.

Return type:

None

set_reference_drop_list(sheet_name, range_ref)[source]

Set a drop-down list from a range reference on another sheet.

Return type:

None

property show_drop_down

Whether to show a drop-down list.

property show_error_message

Whether to show the error message.

property show_input_message

Whether to show the input message.

property sqref

Get the range (sqref) this validation applies to.

property type

Get the validation type.

class pyopenxlsx.DataValidations(raw_dvs, worksheet=None)[source]

Bases: object

Manages all data validation rules in a worksheet.

add_validation(sqref, type='none', operator='between', formula1='', formula2='', **kwargs)[source]

Convenience method to add a data validation rule.

Return type:

DataValidation

append()[source]

Append a new empty data validation rule.

Return type:

DataValidation

clear()[source]

Clear all data validation rules.

Return type:

None

remove(index_or_sqref)[source]

Remove a data validation rule by index or sqref.

Return type:

None

class pyopenxlsx.DefinedName(native)[source]

Bases: object

Thin wrapper around a native XLDefinedName.

Forwards attribute access to the native object (name(), refers_to(), …) so existing call sites keep working.

property raw: Any
class pyopenxlsx.DefinedNames(native, workbook=None)[source]

Bases: object

Collection API for workbook named ranges.

Wraps native XLDefinedNames while keeping append / get / exists / remove compatible with existing call sites. Prefer define() for new code.

all()[source]
Return type:

List[DefinedName]

append(name, formula, local_sheet_id=None)[source]

Native-compatible append (does not replace existing names).

Return type:

Any

count()[source]
Return type:

int

define(name, refers_to, *, local_sheet_id=None, sheet=None, hidden=False, comment='')[source]

Define (or redefine) a named range.

Parameters:
  • name (str) – Defined name (no spaces recommended).

  • refers_to (str) – Formula/reference, e.g. "Sheet1!$A$1:$B$10".

  • local_sheet_id (Optional[int]) – Optional 0-based sheet-local scope.

  • sheet (Any) – Alternative to local_sheet_id; a high-level Worksheet or sheet title string.

  • hidden (bool) – Hide the name from Excel’s UI when True.

  • comment (str) – Optional comment on the defined name.

Return type:

DefinedName

exists(name, local_sheet_id=None)[source]
Return type:

bool

get(name, local_sheet_id=None)[source]
Return type:

DefinedName

property raw: Any
remove(name, local_sheet_id=None)[source]
Return type:

None

class pyopenxlsx.Fill(pattern_type=XLPatternType.Solid, color=None, background_color=None)[source]

Bases: object

background_color()[source]
Return type:

Optional[XLColor]

color()[source]
Return type:

Optional[XLColor]

pattern_type()[source]
Return type:

XLPatternType

set_background_color(value)[source]
Return type:

None

set_color(value)[source]
Return type:

None

set_pattern_type(value)[source]
Return type:

None

class pyopenxlsx.Font(name='Arial', size=11, bold=False, italic=False, color=None, underline=None, strikethrough=False)[source]

Bases: object

bold()[source]
Return type:

bool

color()[source]
Return type:

XLColor

italic()[source]
Return type:

bool

name()[source]
Return type:

str

set_bold(value)[source]
Return type:

None

set_color(value)[source]
Return type:

None

set_italic(value)[source]
Return type:

None

set_name(value)[source]
Return type:

None

set_size(value)[source]
Return type:

None

set_strikethrough(value)[source]
Return type:

None

set_underline(value)[source]
Return type:

None

size()[source]
Return type:

int

strikethrough()[source]
Return type:

bool

underline()[source]
Return type:

XLUnderlineStyle

class pyopenxlsx.Formula(raw_cell)[source]

Bases: object

Wrapper for Excel formulas. Allows interacting with the formula assigned to a cell.

clear()[source]

Clear the formula from the cell.

Return type:

None

property text

Get or set the formula string.

class pyopenxlsx.FormulaEngine[source]

Bases: object

Lightweight formula evaluation engine (single expression).

Prefer this for ad-hoc evaluation. For workbook/sheet recalculation of stored cell formulas, use CalculationEngine.

average(range_or_args, worksheet=None, **kwargs)[source]

Evaluate AVERAGE(...).

Return type:

Any

count(range_or_args, worksheet=None, **kwargs)[source]

Evaluate COUNT(...).

Return type:

Any

evaluate(formula, worksheet=None, *, session=None, reporter=None, current_row=None, current_col=None, current_sheet=None)[source]

Evaluate a formula string.

If a worksheet is provided, cell references within the formula will be resolved. Optionally pass session / reporter, or current_row/col/sheet for parameterless ROW()/COLUMN() and relative features.

The formula may be written with or without a leading =.

Return type:

Any

evaluate_many(formulas, worksheet=None, **kwargs)[source]

Evaluate multiple formulas with the same worksheet/session kwargs.

Return type:

List[Any]

if_(condition, true_value, false_value='FALSE', worksheet=None, **kwargs)[source]

Evaluate IF(condition, true, false).

Return type:

Any

property raw: XLFormulaEngine

Underlying native engine.

sum(range_or_args, worksheet=None, **kwargs)[source]

Evaluate SUM(...) over a range expression or argument list string.

Return type:

Any

class pyopenxlsx.ImageInfo

Bases: object

property extension

File extension (e.g., ‘png’)

property name

Image filename (e.g., ‘image1.png’)

property path

Full path in archive (e.g., ‘xl/media/image1.png’)

class pyopenxlsx.PageMargins(raw_margins, worksheet=None)[source]

Bases: object

Represents the page margins of a worksheet. Values are in inches.

property bottom
property footer
property header
property left
property right
property top
class pyopenxlsx.PageSetup(raw_setup, worksheet=None)[source]

Bases: object

Represents the page setup of a worksheet.

property black_and_white

Whether to print in black and white.

property fit_to_height

The number of pages to fit to height.

property fit_to_width

The number of pages to fit to width.

property orientation

The page orientation (XLPageOrientation).

property paper_size

The paper size (Excel internal paper size enumeration).

property scale

The print scale (in percentage).

class pyopenxlsx.PivotTableBuilder(name, source_range, target_cell='A1')[source]

Bases: object

Build and attach a pivot table with a chainable API.

Example:

PivotTableBuilder("SalesPivot", "Sheet1!A1:C20", "E1") \
    .rows("Region") \
    .columns("Year") \
    .data("Amount", subtotal="sum") \
    .style("PivotStyleMedium9") \
    .add_to(ws)
add_to(worksheet)[source]

Create the pivot table on worksheet and return the native result.

Return type:

Any

columns(*fields, selected_items=None, compact=False, outline=False, show_all=False, insert_blank_row=False, default_subtotal=True)[source]
Return type:

PivotTableBuilder

compact(value=True)[source]
Return type:

PivotTableBuilder

configure(**flags)[source]

Set common boolean options by keyword.

Supported keys map to set_* methods without the set_ prefix, e.g. show_drill=True, use_auto_formatting=True.

Return type:

PivotTableBuilder

data(field, *, name='', subtotal='sum', num_fmt_id=0, show_values_as=None)[source]
Return type:

PivotTableBuilder

data_on_rows(value=True)[source]
Return type:

PivotTableBuilder

filters(*fields, selected_items=None)[source]
Return type:

PivotTableBuilder

grand_totals(*, rows=None, columns=None)[source]
Return type:

PivotTableBuilder

property options: XLPivotTableOptions

Underlying native options object.

rows(*fields, selected_items=None, compact=False, outline=False, show_all=False, insert_blank_row=False, default_subtotal=True)[source]
Return type:

PivotTableBuilder

show_headers(*, rows=None, columns=None)[source]
Return type:

PivotTableBuilder

stripes(*, rows=None, columns=None)[source]
Return type:

PivotTableBuilder

style(style_name)[source]
Return type:

PivotTableBuilder

class pyopenxlsx.PrintOptions(raw_options, worksheet=None)[source]

Bases: object

Represents the print options of a worksheet.

property grid_lines

Whether grid lines are printed.

property headings

Whether row and column headings are printed.

property horizontal_centered

Whether content is horizontally centered on the page.

property vertical_centered

Whether content is vertically centered on the page.

class pyopenxlsx.Protection(locked=True, hidden=False)[source]

Bases: object

pyopenxlsx.PythonMergeCells

alias of MergeCells

class pyopenxlsx.Range(raw_range, worksheet=None)[source]

Bases: object

Lightweight view over a rectangular block of cells.

Architectural role

Range is a geometry + iteration façade: address, dimensions, cell iteration, and clear. Prefer delegating multi-cell style, bulk write, drawing, or workbook I/O to Worksheet / bulk APIs rather than growing kitchen-sink methods on this type.

Uses a weak reference to the parent worksheet to avoid cycles.

property address
clear()[source]
Return type:

None

async clear_async()[source]
Return type:

None

property num_columns
property num_rows
class pyopenxlsx.Side(style=XLLineStyle.Thin, color=None)[source]

Bases: object

color()[source]
Return type:

XLColor

style()[source]
Return type:

XLLineStyle

class pyopenxlsx.StreamReader(native_reader)[source]

Bases: object

Thin façade over the native worksheet stream reader.

close()[source]

Close the stream reader.

Return type:

None

current_row()[source]

Get 1-based index of the last returned row.

Return type:

int

property current_row_index: int

Property alias for current_row().

current_row_opts()[source]

Row attributes (height, hidden, outline_level, etc.) for the last returned row.

Return type:

dict

has_next()[source]

Check if there are more rows to read.

Return type:

bool

iter_sparse()[source]

Iterate yielding non-empty cells as (col_index, value) tuples for zero-overhead ETL.

Return type:

Iterator[List[Tuple[int, Any]]]

property last_error: str | None

Last parse error or None.

next_row()[source]

Read the next row of cell values.

Return type:

List[Any]

next_row_detailed()[source]

Read the next row with detailed cell attributes (formula, style_index, etc.).

Return type:

List[dict]

next_row_sparse()[source]

Read the next row with only non-empty cells (as dicts with column, value, etc.).

Return type:

List[dict]

next_row_strings()[source]

Read the next row as display strings (formatting applied if configured).

Return type:

List[str]

property options: Any

Read options configured on this stream reader.

property raw: Any

Access the underlying native XLStreamReader handle.

class pyopenxlsx.StreamWriter(native_writer, workbook=None)[source]

Bases: object

Thin façade over the native worksheet stream writer.

Add hyperlink to cell. Injected on close.

Return type:

StreamWriter

append_row(values, row_opts=None)[source]
Return type:

None

append_rows(rows_iterable)[source]
Return type:

None

auto_filter(range_str)[source]

Set AutoFilter range (e.g. ‘A1:E100’). Injected on close.

Return type:

StreamWriter

close()[source]
Return type:

None

flush()[source]
Return type:

None

freeze_panes(top_left_or_cols, rows=None)[source]

Freeze panes before row writing starts (e.g. ‘B2’ or cols=1, rows=1).

Return type:

StreamWriter

insert_page_break(cell_ref)[source]

Insert page break at cell reference (e.g. ‘A10’). Injected on close.

Return type:

StreamWriter

property is_active: bool
is_stream_active()[source]

Return True if the native row stream is currently active.

Return type:

bool

property last_row: int
property max_column: int
merge_cells(top_left, bottom_right=None)[source]

Merge a cell range (e.g. ‘A1:C1’ or top_left=’A1’, bottom_right=’C1’).

Return type:

StreamWriter

property raw: Any

Access the underlying native XLStreamWriter handle.

set_auto_filter(range_str)[source]

Alias for auto_filter().

Return type:

StreamWriter

set_column_outline_level(col, level)[source]

Set outline level for column (1-7).

Return type:

StreamWriter

set_column_style(min_col, max_col, style)[source]

Apply style index to columns [min_col, max_col].

Return type:

StreamWriter

set_column_visible(min_col, max_col, visible)[source]

Show or hide columns [min_col, max_col].

Return type:

StreamWriter

set_column_width(min_col, max_col, width)[source]

Set column width for range [min_col, max_col] (1-based, inclusive).

Return type:

StreamWriter

set_row(row, start_col, values, row_opts=None)[source]
Return type:

None

set_row_ref(ref, values, row_opts=None)[source]
Return type:

None

class pyopenxlsx.Style(font=None, fill=None, border=None, alignment=None, number_format=None, protection=None)[source]

Bases: object

class pyopenxlsx.Table(raw_table, worksheet=None)[source]

Bases: object

Represents an Excel Table (ListObject).

append_column(name)[source]

Append a new column to the table.

Return type:

None

property display_name

The display name of the table.

property name

The name of the table. Table names cannot have spaces.

property range

The range reference of the table (e.g., ‘A1:C10’).

property show_column_stripes

Whether column stripes are shown.

property show_first_column

Whether the first column is highlighted.

property show_last_column

Whether the last column is highlighted.

property show_row_stripes

Whether row stripes are shown.

property show_totals_row

Whether the totals row is shown.

property style

The table style name (e.g., ‘TableStyleMedium2’).

class pyopenxlsx.Workbook(filename=None, force_overwrite=True, password=None)[source]

Bases: object

Represents an Excel workbook.

Uses WeakValueDictionary for worksheet caching to allow garbage collection of Worksheet objects when they are no longer referenced elsewhere. Delegates physical file and temporary scratchpad management to an internal _DocumentSession.

property active
add_chartsheet(name)[source]
add_style(font=None, fill=None, border=None, alignment=None, number_format=None, protection=None)[source]

Register a cell style and return its style index.

Implementation lives in pyopenxlsx._style_registry so this method stays a thin public entry point.

Return type:

int

async add_style_async(font=None, fill=None, border=None, alignment=None, number_format=None, protection=None)[source]
Return type:

int

chartsheet_names()[source]
cleanup_shared_strings()[source]
close()[source]
Return type:

None

async close_async()[source]
Return type:

None

compact_styles()[source]

Deduplicate and compact unused cell formats across all worksheets.

Scans all cell, row, and column style references, merges duplicate cellXfs, and cleans up unreachable styles while preserving ECMA-376 invariants (e.g. cellXfs 0).

Return type:

None

copy_worksheet(from_worksheet)[source]
Return type:

Worksheet

async copy_worksheet_async(from_worksheet)[source]
Return type:

Worksheet

create_sheet(title=None, index=None)[source]
Return type:

Worksheet

async create_sheet_async(title=None, index=None)[source]
Return type:

Worksheet

property custom_properties

Get the custom document properties.

property defined_names

Access defined names (named ranges) via DefinedNames.

extract_images(output_dir)[source]

Extract all embedded images to a directory.

Return type:

List[str]

Args:
output_dir: Directory path where images will be saved.

Will be created if it doesn’t exist.

Returns:

list[str]: List of paths to the extracted image files.

Example:
>>> wb = Workbook("test.xlsx")
>>> extracted = wb.extract_images("./images/")
>>> print(f"Extracted {len(extracted)} images")
async extract_images_async(output_dir)[source]

Async version of extract_images.

Return type:

List[str]

get_archive_entries()[source]

Get a list of all files/directories in the underlying zip archive.

Return type:

List[str]

Returns:

list[str]: List of entry paths.

get_archive_entry(path)[source]

Get the raw bytes of an entry from the underlying zip archive.

Return type:

bytes

Args:

path: Path in the archive (e.g., ‘xl/workbook.xml’).

Returns:

bytes: The raw binary data of the entry.

Raises:

RuntimeError: If the entry is not found in the archive.

get_embedded_images()[source]

Get a list of all embedded images in the workbook.

Return type:

List[Any]

Returns:

list[ImageInfo]: List of ImageInfo objects with name, path, and extension attributes.

Example:
>>> wb = Workbook("test.xlsx")
>>> images = wb.get_embedded_images()
>>> for img in images:
...     print(f"Found image: {img.name}")
get_image_data(image_path_or_name)[source]

Get the binary data of an embedded image.

Return type:

bytes

Args:
image_path_or_name: Either the full path (e.g., ‘xl/media/image1.png’)

or just the filename (e.g., ‘image1.png’)

Returns:

bytes: The raw binary data of the image.

Raises:

RuntimeError: If the image is not found in the archive.

Example:
>>> wb = Workbook("test.xlsx")
>>> images = wb.get_embedded_images()
>>> if images:
...     data = wb.get_image_data(images[0].name)
...     with open("extracted_image.png", "wb") as f:
...         f.write(data)
has_archive_entry(path)[source]

Check if the underlying zip archive contains an entry with the given path.

Return type:

bool

Args:

path: Path in the archive (e.g., ‘xl/workbook.xml’).

Returns:

bool: True if the entry exists.

property has_macro

Check if the loaded document contains a VBA macro project.

is_protected()[source]
Return type:

bool

property properties
protect(lock_structure=True, lock_windows=False, password='')[source]
remove(worksheet)[source]
Return type:

None

async remove_async(worksheet)[source]
Return type:

None

save(filename=None, force_overwrite=True, password=None, compact=False)[source]
async save_async(filename=None, force_overwrite=True, password=None, compact=False)[source]
set_full_calculation_on_load()[source]
set_sheet_index(name, index)[source]
sheet_names()[source]
property sheetnames
property styles
unprotect()[source]
validate_package_invariants()[source]

Validate package-level OOXML invariants (also run automatically on save).

property workbook
worksheet_names()[source]
class pyopenxlsx.Worksheet(raw_sheet, workbook=None)[source]

Bases: WorksheetBulkMixin, WorksheetDrawingMixin, WorksheetFeaturesMixin, WorksheetPageMixin, WorksheetProtectionMixin

Represents an Excel worksheet.

Uses WeakValueDictionary for cell caching to allow garbage collection of Cell objects when they are no longer referenced elsewhere.

Performance note

Prefer bulk APIs (set_cell_value, write_rows, set_cells, write_range, get_range_values) for hot loops. Per-cell Cell wrappers allocate Python objects and are best for sparse edits.

append(iterable)[source]
Return type:

None

async append_async(iterable)[source]
Return type:

None

auto_fit_column(column_number)[source]

Auto-fit the specified column.

cell(row, column, value=None)[source]
Return type:

Cell

column(col)[source]

Get a Column object.

Return type:

Column

delete_column(col_number, count=1)[source]

Delete one or more columns starting at the given column number (1-based).

Return type:

bool

delete_row(row_number, count=1)[source]

Delete one or more rows starting at the given row number (1-based).

Return type:

bool

property drawing

Get the drawing object for the worksheet.

find_cell(ref_or_row, col=None)[source]
Return type:

Any

get_row(row_number)[source]

Return the native XLRow handle for a 1-based row index.

group_columns(col_first, col_last, outline_level=1, collapsed=False)[source]
Return type:

None

group_rows(row_first, row_last, outline_level=1, collapsed=False)[source]
Return type:

None

property has_drawing

Check if the worksheet has a drawing (images, charts, etc.).

property index
insert_column(col_number, count=1)[source]

Insert one or more columns at the given column number (1-based).

Return type:

bool

insert_row(row_number, count=1)[source]

Insert one or more rows at the given row number (1-based).

Return type:

bool

iter_native_rows(first=None, last=None)[source]

Iterate native XLRow objects (distinct from rows Cell tuples).

Return type:

Any

iter_rows(min_row=None, max_row=None, min_col=None, max_col=None, values_only=False)[source]

Iterate over worksheet rows, openpyxl-compatible.

Return type:

Iterator[Tuple[Any, ...]]

Args:

min_row: First row (1-based, inclusive). Defaults to 1. max_row: Last row (1-based, inclusive). Defaults to ws.max_row. min_col: First column (1-based, inclusive). Defaults to 1. max_col: Last column (1-based, inclusive). Defaults to ws.max_column. values_only: If True, yield tuples of raw Python values without

creating any Cell objects. Uses the C++ fast-read path (one get_row_values() call per row), so peak memory stays O(columns) regardless of total row count. If False, yield tuples of Cell objects (same semantics as ws.rows, but with configurable range bounds).

Yields:

tuple[Any, …] when values_only=True tuple[Cell, …] when values_only=False

Example:

# openpyxl-compatible value scan (fast):
for row in ws.iter_rows(values_only=True):
    process(row)

# Partial range, Cell objects:
for row in ws.iter_rows(min_row=2, max_row=100, min_col=1, max_col=5):
    for cell in row:
        print(cell.value)
last_cell()[source]
Return type:

Any

property max_column
property max_row
merge_cells(range_string)[source]
Return type:

None

async merge_cells_async(range_string)[source]
Return type:

None

property merges
property name

Alias for title to maintain compatibility and prevent dynamic attribute bugs.

range(*args)[source]
Return type:

Range

property rows

Iterate over all rows as tuples of Cell objects.

For value-only iteration (10-20x faster for read-only access), use:

ws.iter_rows(values_only=True)
set_column_format(column, style_index)[source]
Return type:

None

set_row_format(row, style_index)[source]
Return type:

None

set_show_grid_lines(show)[source]
property sheet_state
show_grid_lines()[source]
Return type:

bool

stream_reader(options=None, *, empty_rows=None, apply_number_formats=None)[source]

Get a stream reader for this worksheet.

Parameters:
  • options (Any) – Optional XLStreamReadOptions instance.

  • empty_rows (Any) – XLStreamEmptyRowPolicy (or pass via options).

  • apply_number_formats (Optional[bool]) – When True, format numeric cells as display strings where applicable (used by next_row_strings).

Return type:

StreamReader

stream_writer(use_shared_strings=False, max_unique_strings=100000)[source]

Get a stream writer for this worksheet.

Returns a StreamWriter that applies the same date/datetime coercion and auto_date_formats behaviour as bulk worksheet writes.

Parameters:
  • use_shared_strings (bool) – When True, reuse shared-string table entries (saves space for repeated text at the cost of a bounded local cache).

  • max_unique_strings (int) – Cap on unique strings cached when use_shared_strings is True.

Return type:

StreamWriter

property title
unmerge_cells(range_string)[source]
Return type:

None

async unmerge_cells_async(range_string)[source]
Return type:

None

property zoom

Get or set the worksheet zoom scale (percentage, e.g., 100).

class pyopenxlsx.XLAlignment(*args, **kwargs)

Bases: object

horizontal(self) → pyopenxlsx._openxlsx.XLAlignmentStyle
indent(self) → int
rotation(self) → int
set_horizontal(self, arg: pyopenxlsx._openxlsx.XLAlignmentStyle, /) → bool
set_indent(self, arg: int, /) → bool
set_rotation(self, arg: int, /) → bool
set_shrink_to_fit(self, set: bool = True) → bool
set_vertical(self, arg: pyopenxlsx._openxlsx.XLAlignmentStyle, /) → bool
set_wrap_text(self, set: bool = True) → bool
shrink_to_fit(self) → bool
vertical(self) → pyopenxlsx._openxlsx.XLAlignmentStyle
wrap_text(self) → bool
class pyopenxlsx.XLAlignmentStyle(*values)

Bases: Enum

Bottom = 5
Center = 3
CenterContinuous = 8
Distributed = 9
Fill = 6
General = 0
Justify = 7
Left = 1
Right = 2
Top = 4
class pyopenxlsx.XLAppProperties

Bases: object

add_heading_pair(self, arg0: str, arg1: int, /) → None
add_sheet_name(self, arg: str, /) → None
align_worksheets(self, arg: collections.abc.Sequence[str], /) → None
append_sheet_name(self, arg: str, /) → None
delete_heading_pair(self, arg: str, /) → None
delete_property(self, arg: str, /) → None
delete_sheet_name(self, arg: str, /) → None
increment_sheet_count(self, arg: int, /) → None
insert_sheet_name(self, arg0: str, arg1: int, /) → None
prepend_sheet_name(self, arg: str, /) → None
property(self, arg: str, /) → str
set_heading_pair(self, arg0: str, arg1: int, /) → None
set_property(self, arg0: str, arg1: str, /) → None
set_sheet_name(self, arg0: str, arg1: str, /) → None
class pyopenxlsx.XLAutoFilter

Bases: object

filter_column(self, arg: int, /) → pyopenxlsx._openxlsx.XLFilterColumn
ref(self) → str
set_ref(self, ref: str) → pyopenxlsx._openxlsx.XLAutoFilter
set_ref_range(self, range: pyopenxlsx._openxlsx.XLCellRange) → pyopenxlsx._openxlsx.XLAutoFilter
class pyopenxlsx.XLAxis

Bases: object

clear_max_bounds(self) → None
clear_min_bounds(self) → None
set_crosses(self, arg: pyopenxlsx._openxlsx.XLAxisCrosses, /) → None
set_crosses_at(self, arg: float, /) → None
set_date_axis(self, arg: bool, /) → None
set_log_scale(self, arg: float, /) → None
set_major_gridlines(self, arg: bool, /) → None
set_major_unit(self, arg: float, /) → None
set_max_bounds(self, arg: float, /) → None
set_min_bounds(self, arg: float, /) → None
set_minor_gridlines(self, arg: bool, /) → None
set_minor_unit(self, arg: float, /) → None
set_number_format(self, format_code: str, source_linked: bool = False) → None
set_orientation(self, arg: pyopenxlsx._openxlsx.XLAxisOrientation, /) → None
set_tick_label_position(self, position: pyopenxlsx._openxlsx.XLAxisTickLabelPosition) → None
set_title(self, arg: str, /) → None
class pyopenxlsx.XLAxisCrosses(*values)

Bases: Enum

AutoZero = 0
Max = 2
Min = 1
class pyopenxlsx.XLAxisOrientation(*values)

Bases: Enum

MaxMin = 1
MinMax = 0
class pyopenxlsx.XLAxisTickLabelPosition(*values)

Bases: Enum

High = 1
Low = 2
NextToAxis = 0
None_ = 3
class pyopenxlsx.XLBorder(*args, **kwargs)

Bases: object

bottom(self) → pyopenxlsx._openxlsx.XLLine
diagonal(self) → pyopenxlsx._openxlsx.XLLine
diagonal_down(self) → bool

True if the diagonal runs from top-left to bottom-right.

diagonal_up(self) → bool

True if the diagonal runs from bottom-left to top-right.

horizontal(self) → pyopenxlsx._openxlsx.XLLine

Get the inner horizontal line (used in merged cell borders).

left(self) → pyopenxlsx._openxlsx.XLLine
outline(self) → bool

True if the border outline attribute is set.

right(self) → pyopenxlsx._openxlsx.XLLine
set_bottom(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool
set_diagonal(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool
set_diagonal_down(self, set: bool = True) → pyopenxlsx._openxlsx.XLBorder

Enable/disable diagonal from top-left to bottom-right.

set_diagonal_up(self, set: bool = True) → pyopenxlsx._openxlsx.XLBorder

Enable/disable diagonal from bottom-left to top-right.

set_horizontal(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool

Set the inner horizontal line style (used in merged cell borders).

set_left(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool
set_outline(self, set: bool = True) → pyopenxlsx._openxlsx.XLBorder

Enable/disable the border outline attribute.

set_right(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool
set_top(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool
set_vertical(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) → bool

Set the inner vertical line style (used in merged cell borders).

summary(self) → str
top(self) → pyopenxlsx._openxlsx.XLLine
vertical(self) → pyopenxlsx._openxlsx.XLLine

Get the inner vertical line (used in merged cell borders).

class pyopenxlsx.XLBorders

Bases: object

border_by_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLBorder
count(self) → int
create(self, copyFrom: pyopenxlsx._openxlsx.XLBorder = <pyopenxlsx._openxlsx.XLBorder object at 0x74900f2c0ad0>, styleEntriesPrefix: str = '\n\t\t') → int
class pyopenxlsx.XLCalcStatus(*values)

Bases: Enum

Circular = 1
Empty = 3
Error = 2
Ok = 0
class pyopenxlsx.XLCalculationEngine(*args, **kwargs)

Bases: object

calc_cell_value(self, a1: str) → object
clear_cache(self) → None
dependencies(self, a1: str) → list[pyopenxlsx._openxlsx.XLCellKey]
dependents(self, a1: str) → list[pyopenxlsx._openxlsx.XLCellKey]
property dirty_count

(self) -> int

extract_dependencies = <nanobind.nb_func object>
property formula_count

(self) -> int

property is_multi_sheet

(self) -> bool

property last_status

(self) -> pyopenxlsx._openxlsx.XLCalcStatus

mark_all_dirty(self) → None
mark_dirty(self, a1: str, propagate: bool = True) → None
notify_changed(self, a1: str) → None
rebuild(self) → None
recalculate(self) → int
recalculate_all(self) → int
reload_defined_names(self) → None
set_input_value(self, a1: str, value: object) → None
update_formula_cell(self, a1: str) → bool
class pyopenxlsx.XLCalculationOptions(*args, **kwargs)

Bases: object

property auto_track_changes

(self) -> bool

property circular_error_token

(self) -> str

property max_depth

(self) -> int

property max_expanded_deps

(self) -> int

property propagate_dirty

(self) -> bool

property set_full_calc_on_load

(self) -> bool

property use_defined_names

(self) -> bool

property write_back

(self) -> bool

class pyopenxlsx.XLCell

Bases: object

add_comment(self, text: str, author: str = '') → pyopenxlsx._openxlsx.XLThreadedComment
add_note(self, text: str, author: str = '') → pyopenxlsx._openxlsx.XLCell
cell_format(self) → int
cell_reference(self) → pyopenxlsx._openxlsx.XLCellReference
clear(self, keep: int = 0) → None
clear_formula(self) → None
copy_from(self, other: pyopenxlsx._openxlsx.XLCell) → None
empty(self) → bool
get_formula(self) → str
get_string(self) → str
has_formula(self) → bool
offset(self, row_offset: int, col_offset: int) → pyopenxlsx._openxlsx.XLCell
set_cell_format(self, arg: int, /) → pyopenxlsx._openxlsx.XLCell
set_formula(self, arg: object, /) → None
set_style(self, style: pyopenxlsx._openxlsx.XLStyle) → pyopenxlsx._openxlsx.XLCell
property value

(self) -> object

exception pyopenxlsx.XLCellAddressError

Bases: XLException

class pyopenxlsx.XLCellFormat(*args, **kwargs)

Bases: object

alignment(self, createIfMissing: bool = False) → pyopenxlsx._openxlsx.XLAlignment
apply_alignment(self) → bool
apply_border(self) → bool
apply_fill(self) → bool
apply_font(self) → bool
apply_number_format(self) → bool
apply_protection(self) → bool
border_index(self) → int
fill_index(self) → int
font_index(self) → int
hidden(self) → bool
locked(self) → bool
number_format_id(self) → int
set_apply_alignment(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_apply_border(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_apply_fill(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_apply_font(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_apply_number_format(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_apply_protection(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_border_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLCellFormat
set_fill_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLCellFormat
set_font_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLCellFormat
set_hidden(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_locked(self, set: bool = True) → pyopenxlsx._openxlsx.XLCellFormat
set_number_format_id(self, arg: int, /) → pyopenxlsx._openxlsx.XLCellFormat
class pyopenxlsx.XLCellFormats

Bases: object

cell_format_by_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLCellFormat
count(self) → int
create(self, copyFrom: pyopenxlsx._openxlsx.XLCellFormat = <pyopenxlsx._openxlsx.XLCellFormat object at 0x74900f89d440>, styleEntriesPrefix: str = '\n\t\t') → int
class pyopenxlsx.XLCellKey(*args, **kwargs)

Bases: object

address(self) → str
property col

(self) -> int

parse = <nanobind.nb_func object>
qualified_address(self) → str
property row

(self) -> int

property sheet

(self) -> str

valid(self) → bool
class pyopenxlsx.XLCellRange

Bases: object

address(self) → str
apply_style(self, style: pyopenxlsx._openxlsx.XLStyle) → None
bottom_right(self) → pyopenxlsx._openxlsx.XLCellReference
clear(self) → None
empty(self) → bool
intersect(self, other: pyopenxlsx._openxlsx.XLCellRange) → pyopenxlsx._openxlsx.XLCellRange
num_columns(self) → int
num_rows(self) → int
set_border_outline(self, style: pyopenxlsx._openxlsx.XLLineStyle, color: pyopenxlsx._openxlsx.XLColor) → None
set_format(self, cell_format_index: int) → pyopenxlsx._openxlsx.XLCellRange
top_left(self) → pyopenxlsx._openxlsx.XLCellReference
class pyopenxlsx.XLCellReference(*args, **kwargs)

Bases: object

address(self) → str
column(self) → int
row(self) → int
set_address(self, address: str) → None
set_column(self, column: int) → None
set_row(self, row: int) → None
set_row_and_column(self, row: int, column: int) → None
class pyopenxlsx.XLCfOperator(*values)

Bases: Enum

BeginsWith = 10
Between = 6
ContainsText = 8
EndsWith = 11
Equal = 2
GreaterThan = 5
GreaterThanOrEqual = 4
LessThan = 0
LessThanOrEqual = 1
NotBetween = 7
NotContains = 9
NotEqual = 3
class pyopenxlsx.XLCfRule(*args, **kwargs)

Bases: object

above_average(self) → bool
add_formula(self, new_formula: str) → bool
bottom(self) → bool
clear_formulas(self) → None
dxf_id(self) → int
empty(self) → bool
equal_average(self) → bool
formula(self) → str
formulas(self) → list[str]
operator_(self) → pyopenxlsx._openxlsx.XLCfOperator
percent(self) → bool
priority(self) → int
rank(self) → int
set_above_average(self, set: bool = True) → pyopenxlsx._openxlsx.XLCfRule
set_bottom(self, set: bool = True) → pyopenxlsx._openxlsx.XLCfRule
set_dxf_id(self, new_dxf_id: int) → pyopenxlsx._openxlsx.XLCfRule
set_equal_average(self, set: bool = True) → pyopenxlsx._openxlsx.XLCfRule
set_formula(self, new_formula: str) → pyopenxlsx._openxlsx.XLCfRule
set_operator(self, new_operator: pyopenxlsx._openxlsx.XLCfOperator) → pyopenxlsx._openxlsx.XLCfRule
set_percent(self, set: bool = True) → pyopenxlsx._openxlsx.XLCfRule
set_priority(self, new_priority: int) → pyopenxlsx._openxlsx.XLCfRule
set_rank(self, new_rank: int) → pyopenxlsx._openxlsx.XLCfRule
set_std_dev(self, new_std_dev: int) → pyopenxlsx._openxlsx.XLCfRule
set_stop_if_true(self, set: bool = True) → pyopenxlsx._openxlsx.XLCfRule
set_text(self, new_text: str) → pyopenxlsx._openxlsx.XLCfRule
set_time_period(self, new_time_period: pyopenxlsx._openxlsx.XLCfTimePeriod) → pyopenxlsx._openxlsx.XLCfRule
set_type(self, new_type: pyopenxlsx._openxlsx.XLCfType) → pyopenxlsx._openxlsx.XLCfRule
std_dev(self) → int
stop_if_true(self) → bool
summary(self) → str
text(self) → str
time_period(self) → pyopenxlsx._openxlsx.XLCfTimePeriod
type(self) → pyopenxlsx._openxlsx.XLCfType
class pyopenxlsx.XLCfRules(*args, **kwargs)

Bases: object

cf_rule_by_index(self, index: int) → pyopenxlsx._openxlsx.XLCfRule
count(self) → int
create(self, copy_from: pyopenxlsx._openxlsx.XLCfRule = <pyopenxlsx._openxlsx.XLCfRule object at 0x74900f9ae250>, cf_rule_prefix: str = '\n\t\t') → int
empty(self) → bool
max_priority_value(self) → int
renumber_priorities(self, increment: int = 1) → None
set_priority(self, cf_rule_index: int, new_priority: int) → bool
summary(self) → str
class pyopenxlsx.XLCfTimePeriod(*values)

Bases: Enum

Last7Days = 3
LastMonth = 5
LastWeek = 8
NextMonth = 6
NextWeek = 9
ThisMonth = 4
ThisWeek = 7
Today = 0
Tomorrow = 2
Yesterday = 1
class pyopenxlsx.XLCfType(*values)

Bases: Enum

AboveAverage = 17
BeginsWith = 10
CellIs = 1
ColorScale = 2
ContainsBlanks = 12
ContainsErrors = 14
ContainsText = 8
DataBar = 3
DuplicateValues = 7
EndsWith = 11
Expression = 0
IconSet = 4
NotContainsBlanks = 13
NotContainsErrors = 15
NotContainsText = 9
TimePeriod = 16
Top10 = 5
UniqueValues = 6
class pyopenxlsx.XLCfvoType(*values)

Bases: Enum

Formula = 4
Invalid = 255
Max = 1
Min = 0
Number = 2
Percent = 3
Percentile = 5
class pyopenxlsx.XLChart

Bases: object

add_bubble_series(self, x_val_ref: str, y_val_ref: str, size_ref: str, title: str = '') → pyopenxlsx._openxlsx.XLChartSeries
add_bubble_series(self, wks: pyopenxlsx._openxlsx.XLWorksheet, x_values: pyopenxlsx._openxlsx.XLCellRange, y_values: pyopenxlsx._openxlsx.XLCellRange, sizes: pyopenxlsx._openxlsx.XLCellRange, title: str = '') → pyopenxlsx._openxlsx.XLChartSeries
add_series(self, wks: pyopenxlsx._openxlsx.XLWorksheet, values: pyopenxlsx._openxlsx.XLCellRange, title: str = '', target_chart_type: pyopenxlsx._openxlsx.XLChartType | None = None, use_secondary_axis: bool = False) → pyopenxlsx._openxlsx.XLChartSeries
add_series(self, wks: pyopenxlsx._openxlsx.XLWorksheet, values: pyopenxlsx._openxlsx.XLCellRange, categories: pyopenxlsx._openxlsx.XLCellRange, title: str = '', target_chart_type: pyopenxlsx._openxlsx.XLChartType | None = None, use_secondary_axis: bool = False) → pyopenxlsx._openxlsx.XLChartSeries
add_series_ref(self, values_ref: str, title: str = '', categories_ref: str = '', target_chart_type: pyopenxlsx._openxlsx.XLChartType | None = None, use_secondary_axis: bool = False) → pyopenxlsx._openxlsx.XLChartSeries
axis(self, arg: str, /) → pyopenxlsx._openxlsx.XLAxis
set_chart_area_color(self, hex_rgb: str) → None
set_gap_width(self, percent: int) → None
set_hole_size(self, arg: int, /) → None
set_legend_position(self, arg: pyopenxlsx._openxlsx.XLLegendPosition, /) → None
set_overlap(self, arg: int, /) → None
set_plot_area_color(self, arg: str, /) → None
set_rotation(self, x: int, y: int, perspective: int = 30) → None
set_series_marker(self, arg0: int, arg1: pyopenxlsx._openxlsx.XLMarkerStyle, /) → None
set_series_smooth(self, arg0: int, arg1: bool, /) → None
set_show_data_labels(self, show_value: bool, show_category: bool = False, show_percent: bool = False) → None
set_show_data_table(self, show_table: bool, show_keys: bool = False) → None
set_style(self, arg: int, /) → None
set_title(self, arg: str, /) → None
x_axis(self) → pyopenxlsx._openxlsx.XLAxis
y_axis(self) → pyopenxlsx._openxlsx.XLAxis
class pyopenxlsx.XLChartAnchor(*args, **kwargs)

Bases: object

property col

(self) -> int

property height

(self) -> OpenXLSX::XLDistance

property name

(self) -> str

property row

(self) -> int

property width

(self) -> OpenXLSX::XLDistance

class pyopenxlsx.XLChartSeries

Bases: object

add_error_bars(self, direction: pyopenxlsx._openxlsx.XLErrorBarDirection, type: pyopenxlsx._openxlsx.XLErrorBarType, val_type: pyopenxlsx._openxlsx.XLErrorBarValueType, value: float = 0.0) → pyopenxlsx._openxlsx.XLChartSeries
add_trendline(self, type: pyopenxlsx._openxlsx.XLTrendlineType, name: str = '', order: int = 2, period: int = 2) → pyopenxlsx._openxlsx.XLChartSeries
set_color(self, hex_rgb: str) → pyopenxlsx._openxlsx.XLChartSeries
set_data_labels(self, show_value: bool, show_category_name: bool = False, show_percent: bool = False) → pyopenxlsx._openxlsx.XLChartSeries
set_data_labels_from_range(self, wks: pyopenxlsx._openxlsx.XLWorksheet, range: pyopenxlsx._openxlsx.XLCellRange) → pyopenxlsx._openxlsx.XLChartSeries
set_data_point_color(self, point_idx: int, hex_rgb: str) → pyopenxlsx._openxlsx.XLChartSeries
set_line_dash(self, dash_type: pyopenxlsx._openxlsx.XLLineDashType) → pyopenxlsx._openxlsx.XLChartSeries
set_line_width(self, points: float) → pyopenxlsx._openxlsx.XLChartSeries
set_marker_style(self, arg: pyopenxlsx._openxlsx.XLMarkerStyle, /) → pyopenxlsx._openxlsx.XLChartSeries
set_smooth(self, arg: bool, /) → pyopenxlsx._openxlsx.XLChartSeries
set_title(self, arg: str, /) → pyopenxlsx._openxlsx.XLChartSeries
class pyopenxlsx.XLChartType(*values)

Bases: Enum

Area = 31
Area3D = 34
Area3DPercentStacked = 36
Area3DStacked = 35
AreaPercentStacked = 33
AreaStacked = 32
Bar = 0
Bar3D = 3
Bar3DPercentStacked = 5
Bar3DStacked = 4
BarPercentStacked = 2
BarStacked = 1
Bubble = 24
Column = 6
Column3D = 9
Column3DPercentStacked = 11
Column3DStacked = 10
ColumnPercentStacked = 8
ColumnStacked = 7
Doughnut = 37
Line = 12
Line3D = 15
LinePercentStacked = 14
LineStacked = 13
Pie = 16
Pie3D = 17
Radar = 38
RadarFilled = 39
RadarMarkers = 40
Scatter = 18
ScatterLine = 19
ScatterLineMarker = 20
ScatterMarker = 23
ScatterSmooth = 21
ScatterSmoothMarker = 22
StockHLC = 25
StockOHLC = 26
Surface = 27
Surface3D = 28
Surface3DWireframe = 30
SurfaceWireframe = 29
class pyopenxlsx.XLChartsheet

Bases: object

color(self) → pyopenxlsx._openxlsx.XLColor
index(self) → int
is_active(self) → bool
is_selected(self) → bool
name(self) → str
set_active(self) → bool
set_color(self, color: pyopenxlsx._openxlsx.XLColor) → None
set_index(self, index: int) → None
set_name(self, name: str) → None
set_selected(self, selected: bool) → None
set_visibility(self, state: pyopenxlsx._openxlsx.XLSheetState) → None
visibility(self) → pyopenxlsx._openxlsx.XLSheetState
class pyopenxlsx.XLColor(*args, **kwargs)

Bases: object

alpha(self) → int
blue(self) → int
green(self) → int
hex(self) → str
red(self) → int
set(self, arg0: int, arg1: int, arg2: int, arg3: int, /) → None
set(self, arg0: int, arg1: int, arg2: int, /) → None
set(self, arg: str, /) → None
class pyopenxlsx.XLColumn

Bases: object

format(self) → int
is_hidden(self) → bool
set_format(self, cellFormatIndex: int) → bool
set_hidden(self, state: bool) → None
set_width(self, width: float) → None
width(self) → float
class pyopenxlsx.XLComment

Bases: object

author_id(self) → int
ref(self) → str
set_author_id(self, arg: int, /) → pyopenxlsx._openxlsx.XLComment
set_text(self, arg: str, /) → pyopenxlsx._openxlsx.XLComment
text(self) → str
valid(self) → bool
class pyopenxlsx.XLComments

Bases: object

add_author(self, arg: str, /) → int
author(self, arg: int, /) → str
author_count(self) → int
count(self) → int
delete_comment(self, arg: str, /) → bool
get(self, arg: int, /) → pyopenxlsx._openxlsx.XLComment
get(self, arg: str, /) → str
set(self, cellRef: str, comment: str, author_id: int = 0, widthCols: int = 4, heightRows: int = 6) → bool
shape(self, arg: str, /) → pyopenxlsx._openxlsx.XLShape
class pyopenxlsx.XLConditionalFormat(*args, **kwargs)

Bases: object

cf_rules(self) → pyopenxlsx._openxlsx.XLCfRules
empty(self) → bool
set_sqref(self, new_sqref: str) → bool
sqref(self) → str
summary(self) → str
class pyopenxlsx.XLConditionalFormats(*args, **kwargs)

Bases: object

count(self) → int
empty(self) → bool
class pyopenxlsx.XLContentItem(*args, **kwargs)

Bases: object

path(self) → str
type(self) → pyopenxlsx._openxlsx.XLContentType
class pyopenxlsx.XLContentType(*values)

Bases: Enum

CalculationChain = 14
Chart = 10
ChartColorStyle = 12
ChartStyle = 11
Chartsheet = 4
Comments = 19
ControlProperties = 13
CoreProperties = 16
CustomProperties = 18
Drawing = 9
ExtendedProperties = 17
Relationships = 1
SharedStrings = 8
Styles = 7
Table = 20
Theme = 6
Unknown = 23
VBAProject = 15
VMLDrawing = 21
Workbook = 0
WorkbookMacroEnabled = 2
Worksheet = 3
class pyopenxlsx.XLContentTypes

Bases: object

add_override(self, arg0: str, arg1: pyopenxlsx._openxlsx.XLContentType, /) → None
content_item(self, arg: str, /) → pyopenxlsx._openxlsx.XLContentItem
delete_override(self, arg: str, /) → None
delete_override(self, arg: pyopenxlsx._openxlsx.XLContentItem, /) → None
get_content_items(self) → list[pyopenxlsx._openxlsx.XLContentItem]
class pyopenxlsx.XLDataBarColor(*args, **kwargs)

Bases: object

automatic(self) → bool
indexed(self) → int
rgb(self) → pyopenxlsx._openxlsx.XLColor

Get the line color from the rgb attribute as an XLColor.

set(self, color: pyopenxlsx._openxlsx.XLColor) → bool

Alias for set_rgb.

set_automatic(self, set: bool = True) → bool
set_indexed(self, index: int) → bool
set_rgb(self, color: pyopenxlsx._openxlsx.XLColor) → bool

Set the color from an XLColor (rgb attribute).

set_theme(self, theme: int) → bool
set_tint(self, tint: float) → bool

Set the color tint (value between -1.0 and +1.0).

summary(self) → str
theme(self) → int
tint(self) → float

Get the color tint value (between -1.0 and +1.0).

class pyopenxlsx.XLDataValidation(*args, **kwargs)

Bases: object

add_cell(self, arg: pyopenxlsx._openxlsx.XLCellReference, /) → None
add_cell(self, arg: str, /) → None
add_range(self, arg0: pyopenxlsx._openxlsx.XLCellReference, arg1: pyopenxlsx._openxlsx.XLCellReference, /) → None
add_range(self, arg: str, /) → None
allow_blank(self) → bool
apply_config(self, arg: pyopenxlsx._openxlsx.XLDataValidationConfig, /) → None
config(self) → pyopenxlsx._openxlsx.XLDataValidationConfig
empty(self) → bool
error(self) → str
error_style(self) → pyopenxlsx._openxlsx.XLDataValidationErrorStyle
error_title(self) → str
formula1(self) → str
formula2(self) → str
ime_mode(self) → pyopenxlsx._openxlsx.XLIMEMode
operator_(self) → pyopenxlsx._openxlsx.XLDataValidationOperator
prompt(self) → str
prompt_title(self) → str
remove_cell(self, arg: pyopenxlsx._openxlsx.XLCellReference, /) → None
remove_cell(self, arg: str, /) → None
remove_range(self, arg0: pyopenxlsx._openxlsx.XLCellReference, arg1: pyopenxlsx._openxlsx.XLCellReference, /) → None
remove_range(self, arg: str, /) → None
set_allow_blank(self, arg: bool, /) → None
set_date_range(self, arg0: str, arg1: str, /) → None
set_decimal_range(self, arg0: float, arg1: float, /) → None
set_error(self, title: str, msg: str, style: pyopenxlsx._openxlsx.XLDataValidationErrorStyle = XLDataValidationErrorStyle.Stop) → None
set_formula1(self, arg: str, /) → None
set_formula2(self, arg: str, /) → None
set_ime_mode(self, arg: pyopenxlsx._openxlsx.XLIMEMode, /) → None
set_list(self, arg: collections.abc.Sequence[str], /) → None
set_operator(self, arg: pyopenxlsx._openxlsx.XLDataValidationOperator, /) → None
set_prompt(self, arg0: str, arg1: str, /) → None
set_reference_drop_list(self, arg0: str, arg1: str, /) → None
set_show_drop_down(self, arg: bool, /) → None
set_show_error_message(self, arg: bool, /) → None
set_show_input_message(self, arg: bool, /) → None
set_sqref(self, arg: str, /) → None
set_text_length_range(self, arg0: int, arg1: int, /) → None
set_time_range(self, arg0: str, arg1: str, /) → None
set_type(self, arg: pyopenxlsx._openxlsx.XLDataValidationType, /) → None
set_whole_number_range(self, arg0: float, arg1: float, /) → None
show_drop_down(self) → bool
show_error_message(self) → bool
show_input_message(self) → bool
sqref(self) → str
type(self) → pyopenxlsx._openxlsx.XLDataValidationType
class pyopenxlsx.XLDataValidationConfig(*args, **kwargs)

Bases: object

property allow_blank

(self) -> bool

property error

(self) -> str

property error_style

(self) -> pyopenxlsx._openxlsx.XLDataValidationErrorStyle

property error_title

(self) -> str

property formula1

(self) -> str

property formula2

(self) -> str

property ime_mode

(self) -> pyopenxlsx._openxlsx.XLIMEMode

property operator_

(self) -> pyopenxlsx._openxlsx.XLDataValidationOperator

property prompt

(self) -> str

property prompt_title

(self) -> str

property show_drop_down

(self) -> bool

property show_error_message

(self) -> bool

property show_input_message

(self) -> bool

property type

(self) -> pyopenxlsx._openxlsx.XLDataValidationType

class pyopenxlsx.XLDataValidationErrorStyle(*values)

Bases: Enum

Information = 2
Stop = 0
Warning = 1
class pyopenxlsx.XLDataValidationOperator(*values)

Bases: Enum

Between = 0
Equal = 1
GreaterThan = 2
GreaterThanOrEqual = 3
LessThan = 4
LessThanOrEqual = 5
NotBetween = 6
NotEqual = 7
class pyopenxlsx.XLDataValidationType(*values)

Bases: Enum

Custom = 1
Date = 2
Decimal = 3
List = 4
None = 0
TextLength = 5
Time = 6
Whole = 7
class pyopenxlsx.XLDataValidations

Bases: object

add_validation(self, arg0: pyopenxlsx._openxlsx.XLDataValidationConfig, arg1: str, /) → pyopenxlsx._openxlsx.XLDataValidation
append(self) → pyopenxlsx._openxlsx.XLDataValidation
at(self, arg: int, /) → pyopenxlsx._openxlsx.XLDataValidation
at(self, arg: str, /) → pyopenxlsx._openxlsx.XLDataValidation
clear(self) → None
count(self) → int
disable_prompts(self) → bool
empty(self) → bool
remove(self, arg: int, /) → None
remove(self, arg: str, /) → None
set_disable_prompts(self, arg: bool, /) → None
set_x_window(self, arg: int, /) → None
set_y_window(self, arg: int, /) → None
x_window(self) → int
y_window(self) → int
class pyopenxlsx.XLDateTime(*args, **kwargs)

Bases: object

as_datetime(self) → object
serial(self) → float
exception pyopenxlsx.XLDateTimeError

Bases: XLException

class pyopenxlsx.XLDefinedName(*args, **kwargs)

Bases: object

comment(self) → str
hidden(self) → bool
local_sheet_id(self) → object
name(self) → str
refers_to(self) → str
set_comment(self, arg: str, /) → None
set_hidden(self, arg: bool, /) → None
set_local_sheet_id(self, arg: int, /) → None
set_name(self, arg: str, /) → None
set_refers_to(self, arg: str, /) → None
valid(self) → bool
class pyopenxlsx.XLDefinedNameIterator

Bases: object

class pyopenxlsx.XLDefinedNames

Bases: object

all(self) → list[pyopenxlsx._openxlsx.XLDefinedName]
append(self, name: str, formula: str) → pyopenxlsx._openxlsx.XLDefinedName
append(self, name: str, formula: str, local_sheet_id: int) → pyopenxlsx._openxlsx.XLDefinedName
count(self) → int
exists(self, name: str) → bool
exists(self, name: str, local_sheet_id: int) → bool
get(self, name: str) → pyopenxlsx._openxlsx.XLDefinedName
get(self, name: str, local_sheet_id: int) → pyopenxlsx._openxlsx.XLDefinedName
remove(self, name: str) → None
remove(self, name: str, local_sheet_id: int) → None
class pyopenxlsx.XLDocument(*args, **kwargs)

Bases: object

add_image(self, name: str, data: bytes) → str

Add an image to the document archive. Returns the path in the archive.

app_properties(self) → pyopenxlsx._openxlsx.XLAppProperties
cleanup_shared_strings(self) → None
close(self) → None
compact_styles(self) → None

Compact and deduplicate cell formats across all worksheets.

compression_level(self) → int
content_types(self) → pyopenxlsx._openxlsx.XLContentTypes
core_properties(self) → pyopenxlsx._openxlsx.XLProperties
create(self, name: str, force_overwrite: bool = True) → None
create_chart(self, type: pyopenxlsx._openxlsx.XLChartType = XLChartType.Bar) → pyopenxlsx._openxlsx.XLChart

Create a chart part (not yet anchored on a worksheet).

create_drawing(self) → pyopenxlsx._openxlsx.XLDrawing
create_pivot_table(self) → pyopenxlsx._openxlsx.XLPivotTable

Create a pivot table package part.

custom_property(self, name: str) → str

Get a custom document property by name

default_author(self) → str
delete_custom_property(self, name: str) → None

Delete a custom document property by name

delete_macro(self) → None
delete_property(self, arg: pyopenxlsx._openxlsx.XLProperty, /) → None
drawing(self, path: str) → pyopenxlsx._openxlsx.XLDrawing
get_archive_entries(self) → list[str]

Get a list of all entries (files/directories) in the underlying zip archive.

get_archive_entry(self, path: str) → bytes

Get the raw bytes of an entry from the underlying zip archive.

get_embedded_images(self) → list[pyopenxlsx._openxlsx.ImageInfo]

Get list of embedded images in the document. Returns list of dicts with ‘name’, ‘path’, ‘extension’ keys.

get_image(self, path: str) → bytes

Get image data as bytes from the document archive.

get_image_data(self, image_path: str) → bytes

Get image data as bytes. image_path can be full path (e.g., ‘xl/media/image1.png’) or just filename (e.g., ‘image1.png’).

get_string(self, index: int) → str
get_string_index(self, str: str) → int
has_archive_entry(self, path: str) → bool

Check if the underlying zip archive contains an entry with the given path.

has_macro(self) → bool
has_persons(self) → bool
has_sheet_comments(self, sheet_xml_no: int) → bool
has_sheet_drawing(self, sheet_xml_no: int) → bool
has_sheet_relationships(self, sheet_xml_no: int, is_chartsheet: bool = False) → bool
has_sheet_tables(self, sheet_xml_no: int) → bool
has_sheet_threaded_comments(self, sheet_xml_no: int) → bool
has_sheet_vml_drawing(self, sheet_xml_no: int) → bool
is_open(self) → bool
name(self) → str
next_table_id(self) → int
open(self, path: str) → None
open(self, path: str, password: str) → None
path(self) → str
persons(self) → pyopenxlsx._openxlsx.XLPersons
property(self, arg: pyopenxlsx._openxlsx.XLProperty, /) → str
save(self) → None
save_as(self, arg0: str, arg1: bool, /) → None
save_as(self, arg0: str, arg1: bool, arg2: str, /) → None
set_compression_level(self, level: int) → None
set_custom_property(self, name: str, value: object) → None

Set a custom document property

set_default_author(self, author: str) → None
set_formula_needs_recalculation(self, status: bool = True) → None
set_property(self, arg0: pyopenxlsx._openxlsx.XLProperty, arg1: str, /) → None
sheet_comments(self, sheet_xml_no: int) → pyopenxlsx._openxlsx.XLComments
sheet_drawing(self, sheet_xml_no: int) → pyopenxlsx._openxlsx.XLDrawing
sheet_relationships(self, sheet_xml_no: int, is_chartsheet: bool = False) → pyopenxlsx._openxlsx.XLRelationships
sheet_tables(self, sheet_xml_no: int) → pyopenxlsx._openxlsx.XLTables
sheet_threaded_comments(self, sheet_xml_no: int) → pyopenxlsx._openxlsx.XLThreadedComments
sheet_vml_drawing(self, sheet_xml_no: int) → pyopenxlsx._openxlsx.XLVmlDrawing
string_count(self) → int
string_exists(self, str: str) → bool
styles(self) → pyopenxlsx._openxlsx.XLStyles
validate_package_invariants(self) → None

Validate package-level OOXML invariants (also run automatically on save).

validate_sheet_name(self, sheet_name: str, throw_on_invalid: bool = False) → bool
workbook(self) → pyopenxlsx._openxlsx.XLWorkbook
class pyopenxlsx.XLDrawing

Bases: object

add_image(self, r_id: str, name: str, description: str, row: int, col: int, width: int, height: int, options: pyopenxlsx._openxlsx.XLImageOptions = <pyopenxlsx._openxlsx.XLImageOptions object at 0x74900f2d21f0>) → None
add_scaled_image(self, r_id: str, name: str, description: str, data: str, row: int, col: int, scaling_factor: float = 1.0) → None
add_shape(self, row: int, col: int, options: pyopenxlsx._openxlsx.XLVectorShapeOptions = <pyopenxlsx._openxlsx.XLVectorShapeOptions object at 0x74900f2301f0>) → None
image(self, index: int) → pyopenxlsx._openxlsx.XLDrawingItem
image_count(self) → int
class pyopenxlsx.XLDrawingItem

Bases: object

col(self) → int
description(self) → str
height(self) → int
image_binary(self) → bytes
name(self) → str
relationship_id(self) → str
row(self) → int
width(self) → int
class pyopenxlsx.XLDxf(*args, **kwargs)

Bases: object

alignment(self) → pyopenxlsx._openxlsx.XLAlignment
border(self) → pyopenxlsx._openxlsx.XLBorder
empty(self) → bool
fill(self) → pyopenxlsx._openxlsx.XLFill
font(self) → pyopenxlsx._openxlsx.XLFont
has_font(self) → bool
num_fmt(self) → pyopenxlsx._openxlsx.XLNumberFormat
summary(self) → str
class pyopenxlsx.XLErrorBarDirection(*values)

Bases: Enum

X = 0
Y = 1
class pyopenxlsx.XLErrorBarType(*values)

Bases: Enum

Both = 0
Minus = 1
Plus = 2
class pyopenxlsx.XLErrorBarValueType(*values)

Bases: Enum

Custom = 0
FixedValue = 1
Percentage = 2
StandardDeviation = 3
StandardError = 4
class pyopenxlsx.XLEvalSession(*args, **kwargs)

Bases: object

property current_col

(self) -> int

property current_row

(self) -> int

property current_sheet

(self) -> str

property has_current_cell

(self) -> bool

set_current_cell(self, row: int, col: int) → pyopenxlsx._openxlsx.XLEvalSession
set_current_sheet(self, sheet_name: str) → pyopenxlsx._openxlsx.XLEvalSession
set_name_resolver(self, callback: object) → pyopenxlsx._openxlsx.XLEvalSession
exception pyopenxlsx.XLException

Bases: RuntimeError

class pyopenxlsx.XLFill(*args, **kwargs)

Bases: object

background_color(self) → pyopenxlsx._openxlsx.XLColor
color(self) → pyopenxlsx._openxlsx.XLColor
fill_type(self) → pyopenxlsx._openxlsx.XLFillType
pattern_type(self) → pyopenxlsx._openxlsx.XLPatternType
set_background_color(self, arg: pyopenxlsx._openxlsx.XLColor, /) → pyopenxlsx._openxlsx.XLFill
set_color(self, arg: pyopenxlsx._openxlsx.XLColor, /) → pyopenxlsx._openxlsx.XLFill
set_fill_type(self, newFillType: pyopenxlsx._openxlsx.XLFillType, force: bool = False) → bool
set_pattern_type(self, arg: pyopenxlsx._openxlsx.XLPatternType, /) → pyopenxlsx._openxlsx.XLFill
class pyopenxlsx.XLFillType(*values)

Bases: Enum

Gradient = 0
Pattern = 1
class pyopenxlsx.XLFills

Bases: object

count(self) → int
create(self, copyFrom: pyopenxlsx._openxlsx.XLFill = <pyopenxlsx._openxlsx.XLFill object at 0x74900f2c0630>, styleEntriesPrefix: str = '\n\t\t') → int
fill_by_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLFill
class pyopenxlsx.XLFilterColumn

Bases: object

add_filter(self, arg: str, /) → None
clear_filters(self) → None
col_id(self) → int
set_custom_filter(self, arg0: str, arg1: str, /) → None
set_custom_filter(self, arg0: str, arg1: str, arg2: pyopenxlsx._openxlsx.XLFilterLogic, arg3: str, arg4: str, /) → None
set_top10(self, value: float, percent: bool = False, top: bool = True) → None
class pyopenxlsx.XLFilterLogic(*values)

Bases: Enum

And = 0
Or = 1
class pyopenxlsx.XLFont(*args, **kwargs)

Bases: object

bold(self) → bool
color(self) → pyopenxlsx._openxlsx.XLColor
italic(self) → bool
name(self) → str
scheme(self) → pyopenxlsx._openxlsx.XLFontSchemeStyle
set_bold(self, set: bool = True) → pyopenxlsx._openxlsx.XLFont
set_color(self, arg: pyopenxlsx._openxlsx.XLColor, /) → pyopenxlsx._openxlsx.XLFont
set_italic(self, set: bool = True) → pyopenxlsx._openxlsx.XLFont
set_name(self, arg: str, /) → pyopenxlsx._openxlsx.XLFont
set_scheme(self, arg: pyopenxlsx._openxlsx.XLFontSchemeStyle, /) → pyopenxlsx._openxlsx.XLFont
set_size(self, arg: int, /) → pyopenxlsx._openxlsx.XLFont
set_strikethrough(self, set: bool = True) → pyopenxlsx._openxlsx.XLFont
set_underline(self, style: pyopenxlsx._openxlsx.XLUnderlineStyle = XLUnderlineStyle.Single) → pyopenxlsx._openxlsx.XLFont
set_vert_align(self, arg: pyopenxlsx._openxlsx.XLVerticalAlignRunStyle, /) → pyopenxlsx._openxlsx.XLFont
size(self) → int
strikethrough(self) → bool
underline(self) → pyopenxlsx._openxlsx.XLUnderlineStyle
vert_align(self) → pyopenxlsx._openxlsx.XLVerticalAlignRunStyle
class pyopenxlsx.XLFontSchemeStyle(*values)

Bases: Enum

Major = 1
Minor = 2
None = 0
class pyopenxlsx.XLFonts

Bases: object

count(self) → int
create(self, copyFrom: pyopenxlsx._openxlsx.XLFont = <pyopenxlsx._openxlsx.XLFont object at 0x74900f2c0df0>, styleEntriesPrefix: str = '\n\t\t') → int
font_by_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLFont
class pyopenxlsx.XLFormula(*args, **kwargs)

Bases: object

clear(self) → pyopenxlsx._openxlsx.XLFormula
get(self) → str
class pyopenxlsx.XLFormulaDiagnostic

Bases: object

property message

(self) -> str

property offset

(self) -> int

class pyopenxlsx.XLFormulaDiagnosticReporter(*args, **kwargs)

Bases: object

clear(self) → None
diagnostics(self) → list[pyopenxlsx._openxlsx.XLFormulaDiagnostic]
get_full_report(self) → str
has_errors(self) → bool
report_error(self, message: str, offset: int) → None
class pyopenxlsx.XLFormulaEngine(*args, **kwargs)

Bases: object

evaluate(self, formula: str, wks: pyopenxlsx._openxlsx.XLWorksheet | None = None, session: pyopenxlsx._openxlsx.XLEvalSession | None = None, reporter: pyopenxlsx._openxlsx.XLFormulaDiagnosticReporter | None = None) → object

Evaluate a formula. Optionally provide a worksheet, XLEvalSession, and/or diagnostic reporter.

exception pyopenxlsx.XLFormulaError

Bases: XLException

class pyopenxlsx.XLHeaderFooter(*args, **kwargs)

Bases: object

align_with_margins(self) → bool
different_first(self) → bool
different_odd_even(self) → bool
even_header(self) → str
first_header(self) → str
odd_header(self) → str
scale_with_doc(self) → bool
set_align_with_margins(self, arg: bool, /) → None
set_different_first(self, arg: bool, /) → None
set_different_odd_even(self, arg: bool, /) → None
set_even_header(self, arg: str, /) → None
set_first_header(self, arg: str, /) → None
set_odd_header(self, arg: str, /) → None
set_scale_with_doc(self, arg: bool, /) → None
class pyopenxlsx.XLIMEMode(*values)

Bases: Enum

Disabled = 3
FullAlpha = 7
FullHangul = 9
FullKatakana = 5
HalfAlpha = 8
HalfHangul = 10
HalfKatakana = 6
Hiragana = 4
NoControl = 0
Off = 1
On = 2
class pyopenxlsx.XLImageOptions(*args, **kwargs)

Bases: object

property bottom_right_cell

(self) -> str

property locked

(self) -> bool

property offset_x

(self) -> int

property offset_y

(self) -> int

property positioning

(self) -> pyopenxlsx._openxlsx.XLImagePositioning

property print_with_sheet

(self) -> bool

property scale_x

(self) -> float

property scale_y

(self) -> float

class pyopenxlsx.XLImagePositioning(*values)

Bases: Enum

Absolute = 2
OneCell = 0
TwoCell = 1
exception pyopenxlsx.XLInputError

Bases: XLException

exception pyopenxlsx.XLInternalError

Bases: XLException

class pyopenxlsx.XLLegendPosition(*values)

Bases: Enum

Bottom = 0
Hidden = 5
Left = 1
Right = 2
Top = 3
TopRight = 4
class pyopenxlsx.XLLine(*args, **kwargs)

Bases: object

color(self) → pyopenxlsx._openxlsx.XLDataBarColor

Get the line color as an XLDataBarColor object (supports in-place mutation).

style(self) → pyopenxlsx._openxlsx.XLLineStyle

Get the line style as an XLLineStyle enum.

summary(self) → str
class pyopenxlsx.XLLineDashType(*values)

Bases: Enum

Dash = 3
DashDot = 5
Dot = 2
LgDash = 4
LgDashDot = 6
LgDashDotDot = 7
Solid = 1
SysDash = 8
SysDashDot = 10
SysDot = 9
Unset = 0
class pyopenxlsx.XLLineStyle(*values)

Bases: Enum

DashDot = 9
DashDotDot = 11
Dashed = 3
Dotted = 4
Double = 6
Hair = 7
Medium = 2
MediumDashDot = 10
MediumDashDotDot = 12
MediumDashed = 8
None = 0
SlantDashDot = 13
Thick = 5
Thin = 1
class pyopenxlsx.XLMarkerStyle(*values)

Bases: Enum

Circle = 1
Dash = 2
Default = 11
Diamond = 3
Dot = 4
None = 0
Picture = 5
Plus = 6
Square = 7
Star = 8
Triangle = 9
X = 10
class pyopenxlsx.XLMergeCells

Bases: object

append_merge(self, arg: str, /) → int
count(self) → int
delete_merge(self, arg: int, /) → None
find_merge(self, arg: str, /) → int
merge_exists(self, arg: str, /) → bool
class pyopenxlsx.XLNumberFormat(*args, **kwargs)

Bases: object

format_code(self) → str
number_format_id(self) → int
set_format_code(self, arg: str, /) → bool
set_number_format_id(self, arg: int, /) → bool
class pyopenxlsx.XLNumberFormats

Bases: object

count(self) → int
create(self, copyFrom: pyopenxlsx._openxlsx.XLNumberFormat = <pyopenxlsx._openxlsx.XLNumberFormat object at 0x74900f2c10b0>, styleEntriesPrefix: str = '\n\t\t') → int
number_format_by_id(self, arg: int, /) → pyopenxlsx._openxlsx.XLNumberFormat
number_format_by_index(self, arg: int, /) → pyopenxlsx._openxlsx.XLNumberFormat
class pyopenxlsx.XLNumberFormatter(*args, **kwargs)

Bases: object

format(self, value: object) → str

Formats the given Python value according to the format string

exception pyopenxlsx.XLOverflowError

Bases: XLException

class pyopenxlsx.XLPageMargins(*args, **kwargs)

Bases: object

bottom(self) → float
footer(self) → float
header(self) → float
left(self) → float
right(self) → float
set_bottom(self, arg: float, /) → pyopenxlsx._openxlsx.XLPageMargins
set_header(self, arg: float, /) → pyopenxlsx._openxlsx.XLPageMargins
set_left(self, arg: float, /) → pyopenxlsx._openxlsx.XLPageMargins
set_right(self, arg: float, /) → pyopenxlsx._openxlsx.XLPageMargins
set_top(self, arg: float, /) → pyopenxlsx._openxlsx.XLPageMargins
top(self) → float
class pyopenxlsx.XLPageOrientation(*values)

Bases: Enum

Default = 0
Landscape = 2
Portrait = 1
class pyopenxlsx.XLPageSetup(*args, **kwargs)

Bases: object

black_and_white(self) → bool
first_page_number(self) → int
fit_to_height(self) → int
fit_to_width(self) → int
orientation(self) → pyopenxlsx._openxlsx.XLPageOrientation
page_order(self) → str
paper_size(self) → int
scale(self) → int
set_black_and_white(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPageSetup
set_first_page_number(self, arg: int, /) → pyopenxlsx._openxlsx.XLPageSetup
set_fit_to_height(self, arg: int, /) → pyopenxlsx._openxlsx.XLPageSetup
set_fit_to_width(self, arg: int, /) → pyopenxlsx._openxlsx.XLPageSetup
set_orientation(self, arg: pyopenxlsx._openxlsx.XLPageOrientation, /) → pyopenxlsx._openxlsx.XLPageSetup
set_page_order(self, arg: str, /) → pyopenxlsx._openxlsx.XLPageSetup
set_paper_size(self, arg: int, /) → pyopenxlsx._openxlsx.XLPageSetup
set_scale(self, arg: int, /) → pyopenxlsx._openxlsx.XLPageSetup
set_use_first_page_number(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPageSetup
use_first_page_number(self) → bool
class pyopenxlsx.XLPane(*values)

Bases: Enum

BottomLeft = 2
BottomRight = 0
TopLeft = 3
TopRight = 1
class pyopenxlsx.XLPaneState(*values)

Bases: Enum

Frozen = 1
FrozenSplit = 2
Split = 0
class pyopenxlsx.XLPatternType(*values)

Bases: Enum

DarkDown = 7
DarkGray = 3
DarkGrid = 9
DarkHorizontal = 5
DarkTrellis = 10
DarkUp = 8
DarkVertical = 6
Gray0625 = 18
Gray125 = 17
LightDown = 13
LightGray = 4
LightGrid = 15
LightHorizontal = 11
LightTrellis = 16
LightUp = 14
LightVertical = 12
MediumGray = 2
None = 0
Solid = 1
class pyopenxlsx.XLPerson(*args, **kwargs)

Bases: object

property display_name

(self) -> str

property id

(self) -> str

property valid

(self) -> bool

class pyopenxlsx.XLPersons(*args, **kwargs)

Bases: object

add_person(self, display_name: str) → str
person(self, id: str) → pyopenxlsx._openxlsx.XLPerson
class pyopenxlsx.XLPivotField(*args, **kwargs)

Bases: object

property compact

(self) -> bool

property custom_name

(self) -> str

property default_subtotal

(self) -> bool

property insert_blank_row

(self) -> bool

property name

(self) -> str

property num_fmt_id

(self) -> int

property outline

(self) -> bool

property show_all

(self) -> bool

property show_values_as

(self) -> pyopenxlsx._openxlsx.XLPivotShowValuesAsOptions

property subtotal

(self) -> OpenXLSX::XLPivotSubtotal

class pyopenxlsx.XLPivotShowValuesAs(*values)

Bases: Enum

DifferenceFrom = 8
Index = 14
Normal = 0
PercentDifferenceFrom = 9
PercentOf = 4
PercentOfColumnTotal = 2
PercentOfGrandTotal = 1
PercentOfParentColumnTotal = 6
PercentOfParentRowTotal = 5
PercentOfParentTotal = 7
PercentOfRowTotal = 3
PercentRunningTotalIn = 11
RankLargestToSmallest = 13
RankSmallestToLargest = 12
RunningTotalIn = 10
class pyopenxlsx.XLPivotShowValuesAsOptions(*args, **kwargs)

Bases: object

property base_field

(self) -> str

property base_item

(self) -> str

property type

(self) -> pyopenxlsx._openxlsx.XLPivotShowValuesAs

class pyopenxlsx.XLPivotSubtotal(*values)

Bases: Enum

Average = 1
Count = 2
CountNums = 6
Max = 3
Min = 4
Product = 5
StdDev = 7
StdDevP = 8
Sum = 0
Var = 9
VarP = 10
class pyopenxlsx.XLPivotTable

Bases: object

name(self) → str
set_name(self, arg: str, /) → None
source_range(self) → str
target_cell(self) → str
class pyopenxlsx.XLPivotTableOptions(*args, **kwargs)

Bases: object

add_column_field(self, field_name: str, selected_items: collections.abc.Sequence[str] = [], compact: bool = False, outline: bool = False, show_all: bool = False, insert_blank_row: bool = False, default_subtotal: bool = True) → pyopenxlsx._openxlsx.XLPivotTableOptions
add_data_field(self, field_name: str, custom_name: str = '', subtotal: pyopenxlsx._openxlsx.XLPivotSubtotal = XLPivotSubtotal.Sum, num_fmt_id: int = 0, show_values_as: pyopenxlsx._openxlsx.XLPivotShowValuesAsOptions = <pyopenxlsx._openxlsx.XLPivotShowValuesAsOptions object at 0x74900f228ed0>) → pyopenxlsx._openxlsx.XLPivotTableOptions
add_filter_field(self, field_name: str, selected_items: collections.abc.Sequence[str] = []) → pyopenxlsx._openxlsx.XLPivotTableOptions
add_row_field(self, field_name: str, selected_items: collections.abc.Sequence[str] = [], compact: bool = False, outline: bool = False, show_all: bool = False, insert_blank_row: bool = False, default_subtotal: bool = True) → pyopenxlsx._openxlsx.XLPivotTableOptions
property columns

(self) -> list[pyopenxlsx._openxlsx.XLPivotField]

property data

(self) -> list[pyopenxlsx._openxlsx.XLPivotField]

property filters

(self) -> list[pyopenxlsx._openxlsx.XLPivotField]

property name

(self) -> str

property pivot_table_style_name

(self) -> str

property rows

(self) -> list[pyopenxlsx._openxlsx.XLPivotField]

set_col_grand_totals(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_compact_data(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_data_on_rows(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_merge_item(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_page_over_then_down(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_pivot_table_style(self, arg: str, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_row_grand_totals(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_col_headers(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_col_stripes(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_drill(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_error(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_last_column(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_row_headers(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_show_row_stripes(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
set_use_auto_formatting(self, arg: bool, /) → pyopenxlsx._openxlsx.XLPivotTableOptions
property source_range

(self) -> str

property target_cell

(self) -> str

class pyopenxlsx.XLPrintOptions(*args, **kwargs)

Bases: object

grid_lines(self) → bool
headings(self) → bool
horizontal_centered(self) → bool
set_grid_lines(self, arg: bool, /) → None
set_headings(self, arg: bool, /) → None
set_horizontal_centered(self, arg: bool, /) → None
set_vertical_centered(self, arg: bool, /) → None
vertical_centered(self) → bool
class pyopenxlsx.XLProperties

Bases: object

delete_property(self, arg: str, /) → None
property(self, arg: str, /) → str
set_property(self, arg0: str, arg1: str, /) → None
set_property(self, arg0: str, arg1: int, /) → None
set_property(self, arg0: str, arg1: float, /) → None
class pyopenxlsx.XLProperty(*values)

Bases: Enum

AppVersion = 19
Application = 10
Category = 9
Company = 14
CreationDate = 7
Creator = 2
Description = 4
DocSecurity = 11
HyperlinkBase = 17
HyperlinksChanged = 18
Keywords = 3
LastModifiedBy = 5
LastPrinted = 6
LinksUpToDate = 15
Manager = 13
ModificationDate = 8
ScaleCrop = 12
SharedDoc = 16
Subject = 1
Title = 0
exception pyopenxlsx.XLPropertyError

Bases: XLException

class pyopenxlsx.XLRelationshipItem(*args, **kwargs)

Bases: object

empty(self) → bool
id(self) → str
target(self) → str
type(self) → pyopenxlsx._openxlsx.XLRelationshipType
class pyopenxlsx.XLRelationshipType(*values)

Bases: Enum

CalculationChain = 8
Chart = 13
ChartColorStyle = 15
ChartStyle = 14
Chartsheet = 5
Comments = 23
ControlProperties = 22
CoreProperties = 0
CustomProperties = 2
Dialogsheet = 6
Drawing = 17
ExtendedProperties = 1
ExternalLinkPath = 10
Image = 16
Macrosheet = 7
Person = 33
PivotCacheDefinition = 30
PivotCacheRecords = 31
PivotTable = 27
PrinterSettings = 20
SharedStrings = 19
Slicer = 28
SlicerCache = 29
Styles = 12
Table = 24
Theme = 11
ThreadedComments = 32
Unknown = 26
VBAProject = 21
VMLDrawing = 18
Workbook = 3
Worksheet = 4
class pyopenxlsx.XLRelationships

Bases: object

add_relationship(self, type: pyopenxlsx._openxlsx.XLRelationshipType, target: str, is_external: bool = False) → pyopenxlsx._openxlsx.XLRelationshipItem
delete_relationship(self, rel_id: str) → None
delete_relationship_item(self, item: pyopenxlsx._openxlsx.XLRelationshipItem) → None
id_exists(self, id: str) → bool
relationship_by_id(self, id: str) → pyopenxlsx._openxlsx.XLRelationshipItem
relationship_by_target(self, target: str, throw_if_not_found: bool = True) → pyopenxlsx._openxlsx.XLRelationshipItem
relationships(self) → list[pyopenxlsx._openxlsx.XLRelationshipItem]
target_exists(self, target: str) → bool
class pyopenxlsx.XLRichText(*args, **kwargs)

Bases: object

add_run(self, arg: pyopenxlsx._openxlsx.XLRichTextRun, /) → pyopenxlsx._openxlsx.XLRichText
add_run(self, arg: str, /) → pyopenxlsx._openxlsx.XLRichTextRun
clear(self) → None
empty(self) → bool
get_runs(self) → list[pyopenxlsx._openxlsx.XLRichTextRun]
property plain_text

(self) -> str

property runs

(self) -> collections.abc.Iterator[pyopenxlsx._openxlsx.XLRichTextRun]

class pyopenxlsx.XLRichTextRun(*args, **kwargs)

Bases: object

property bold

(self) -> object

property font_color

(self) -> object

property font_name

(self) -> object

property font_size

(self) -> object

property italic

(self) -> object

property strikethrough

(self) -> object

property text

(self) -> str

property underline

(self) -> object

class pyopenxlsx.XLRow(*args, **kwargs)

Bases: object

cell_count(self) → int
descent(self) → float
empty(self) → bool
find_cell(self, column_number: int) → pyopenxlsx._openxlsx.XLCell
format(self) → int
height(self) → float
is_collapsed(self) → bool
is_hidden(self) → bool
outline_level(self) → int
row_number(self) → int
set_collapsed(self, state: bool) → None
set_descent(self, descent: float) → None
set_format(self, cell_format_index: int) → bool
set_height(self, height: float) → None
set_hidden(self, state: bool) → None
set_outline_level(self, level: int) → None
set_values(self, values: collections.abc.Sequence) → None
values(self) → list

Return all cell values in this row as a list.

class pyopenxlsx.XLRowRange

Bases: object

row_count(self) → int
class pyopenxlsx.XLShape

Bases: object

allow_in_cell(self) → bool
client_data(self) → pyopenxlsx._openxlsx.XLShapeClientData
fill_color(self) → str
set_allow_in_cell(self, arg: bool, /) → bool
set_fill_color(self, arg: str, /) → bool
set_stroked(self, arg: bool, /) → bool
set_style(self, arg: str, /) → bool
set_style_obj(self, arg: pyopenxlsx._openxlsx.XLShapeStyle, /) → bool
set_type(self, arg: str, /) → bool
shape_id(self) → str
stroked(self) → bool
style(self) → pyopenxlsx._openxlsx.XLShapeStyle
type(self) → str
class pyopenxlsx.XLShapeClientData

Bases: object

anchor(self) → str
auto_fill(self) → bool
column(self) → int
move_with_cells(self) → bool
object_type(self) → str
row(self) → int
set_anchor(self, arg: str, /) → bool
set_auto_fill(self, arg: bool, /) → bool
set_column(self, arg: int, /) → bool
set_move_with_cells(self, arg: bool, /) → bool
set_object_type(self, arg: str, /) → bool
set_row(self, arg: int, /) → bool
set_size_with_cells(self, arg: bool, /) → bool
set_text_h_align(self, arg: pyopenxlsx._openxlsx.XLShapeTextHAlign, /) → bool
set_text_v_align(self, arg: pyopenxlsx._openxlsx.XLShapeTextVAlign, /) → bool
size_with_cells(self) → bool
text_h_align(self) → pyopenxlsx._openxlsx.XLShapeTextHAlign
text_v_align(self) → pyopenxlsx._openxlsx.XLShapeTextVAlign
class pyopenxlsx.XLShapeStyle

Bases: object

height(self) → int
hidden(self) → bool
hide(self) → bool
margin_left(self) → int
margin_top(self) → int
mso_wrap_style(self) → str
position(self) → str
raw(self) → str
set_height(self, arg: int, /) → bool
set_margin_left(self, arg: int, /) → bool
set_margin_top(self, arg: int, /) → bool
set_mso_wrap_style(self, arg: str, /) → bool
set_position(self, arg: str, /) → bool
set_raw(self, arg: str, /) → bool
set_v_text_anchor(self, arg: str, /) → bool
set_width(self, arg: int, /) → bool
show(self) → bool
v_text_anchor(self) → str
visible(self) → bool
width(self) → int
class pyopenxlsx.XLShapeTextHAlign(*values)

Bases: Enum

Center = 3
Invalid = 255
Left = 1
Right = 2
class pyopenxlsx.XLShapeTextVAlign(*values)

Bases: Enum

Bottom = 5
Center = 3
Invalid = 255
Top = 4
class pyopenxlsx.XLSheet

Bases: object

as_chartsheet(self) → pyopenxlsx._openxlsx.XLChartsheet
as_worksheet(self) → pyopenxlsx._openxlsx.XLWorksheet
color(self) → pyopenxlsx._openxlsx.XLColor
index(self) → int
is_active(self) → bool
is_chartsheet(self) → bool
is_selected(self) → bool
is_worksheet(self) → bool
name(self) → str
set_active(self) → bool
set_color(self, color: pyopenxlsx._openxlsx.XLColor) → None
set_index(self, index: int) → None
set_name(self, name: str) → None
set_selected(self, selected: bool) → None
set_visibility(self, state: pyopenxlsx._openxlsx.XLSheetState) → None
visibility(self) → pyopenxlsx._openxlsx.XLSheetState
exception pyopenxlsx.XLSheetError

Bases: XLException

class pyopenxlsx.XLSheetProtectionOptions(*args, **kwargs)

Bases: object

property auto_filter

(self) -> bool

property delete_columns

(self) -> bool

property delete_rows

(self) -> bool

property format_cells

(self) -> bool

property format_columns

(self) -> bool

property format_rows

(self) -> bool

property insert_columns

(self) -> bool

(self) -> bool

property insert_rows

(self) -> bool

property objects

(self) -> bool

property pivot_tables

(self) -> bool

property scenarios

(self) -> bool

property select_locked_cells

(self) -> bool

property select_unlocked_cells

(self) -> bool

property sheet

(self) -> bool

property sort

(self) -> bool

class pyopenxlsx.XLSheetState(*values)

Bases: Enum

Hidden = 1
VeryHidden = 2
Visible = 0
class pyopenxlsx.XLSheetType(*values)

Bases: Enum

Chartsheet = 1
Dialogsheet = 2
Macrosheet = 3
Worksheet = 0
class pyopenxlsx.XLSlicer(*args, **kwargs)

Bases: object

property cache

(self) -> str

property caption

(self) -> str

property cell_ref

(self) -> str

property column_count

(self) -> int

property height

(self) -> int

property is_sort_descending

(self) -> bool

property items

(self) -> list[str]

property locked_position

(self) -> bool

move_to(self, cell_ref: str) → pyopenxlsx._openxlsx.XLSlicer
property name

(self) -> str

resize(self, width_px: int, height_px: int) → pyopenxlsx._openxlsx.XLSlicer
property selected_items

(self) -> list[str]

set_caption(self, caption: str) → pyopenxlsx._openxlsx.XLSlicer
set_style(self, style: pyopenxlsx._openxlsx.XLSlicerStyle) → pyopenxlsx._openxlsx.XLSlicer
set_style_raw(self, raw_style_name: str) → pyopenxlsx._openxlsx.XLSlicer
show_all(self) → pyopenxlsx._openxlsx.XLSlicer
property show_caption

(self) -> bool

show_only(self, items: collections.abc.Sequence[str]) → pyopenxlsx._openxlsx.XLSlicer
property style

(self) -> pyopenxlsx._openxlsx.XLSlicerStyle

property style_raw

(self) -> str

property valid

(self) -> bool

property width

(self) -> int

class pyopenxlsx.XLSlicerBuilder

Bases: object

build(self) → pyopenxlsx._openxlsx.XLSlicer
caption(self, c: str) → pyopenxlsx._openxlsx.XLSlicerBuilder
column_count(self, cols: int) → pyopenxlsx._openxlsx.XLSlicerBuilder
locked_position(self, locked: bool = True) → pyopenxlsx._openxlsx.XLSlicerBuilder
name(self, n: str) → pyopenxlsx._openxlsx.XLSlicerBuilder
offset(self, dx: int, dy: int) → pyopenxlsx._openxlsx.XLSlicerBuilder
show_only(self, items: collections.abc.Sequence[str]) → pyopenxlsx._openxlsx.XLSlicerBuilder
size(self, width_px: int, height_px: int) → pyopenxlsx._openxlsx.XLSlicerBuilder
sort_descending(self, desc: bool = True) → pyopenxlsx._openxlsx.XLSlicerBuilder
style(self, s: pyopenxlsx._openxlsx.XLSlicerStyle) → pyopenxlsx._openxlsx.XLSlicerBuilder
style_raw(self, raw_name: str) → pyopenxlsx._openxlsx.XLSlicerBuilder
class pyopenxlsx.XLSlicerCollection

Bases: object

add(self, cell_ref: str, table: pyopenxlsx._openxlsx.XLTable, column_name: str) → pyopenxlsx._openxlsx.XLSlicerBuilder
add_pivot(self, cell_ref: str, pivot_table: pyopenxlsx._openxlsx.XLPivotTable, field_name: str) → pyopenxlsx._openxlsx.XLSlicerBuilder
contains(self, name: str) → bool
property count

(self) -> int

property empty

(self) -> bool

find(self, name: str) → pyopenxlsx._openxlsx.XLSlicer
remove(self, key: object) → None
property valid

(self) -> bool

class pyopenxlsx.XLSlicerOptions(*args, **kwargs)

Bases: object

property caption

(self) -> str

property height

(self) -> int

property name

(self) -> str

property offset_x

(self) -> int

property offset_y

(self) -> int

property width

(self) -> int

class pyopenxlsx.XLSlicerStyle(*values)

Bases: Enum

Custom = 255
Dark1 = 6
Dark2 = 7
Dark3 = 8
Dark4 = 9
Dark5 = 10
Dark6 = 11
Light1 = 0
Light2 = 1
Light3 = 2
Light4 = 3
Light5 = 4
Light6 = 5
Other1 = 12
Other2 = 13
class pyopenxlsx.XLSparklineOptions(*args, **kwargs)

Bases: object

property display_empty_cells_as

(self) -> str

property display_x_axis

(self) -> bool

property first

(self) -> bool

property first_marker_color

(self) -> str

property high

(self) -> bool

property high_marker_color

(self) -> str

property last

(self) -> bool

property last_marker_color

(self) -> str

property low

(self) -> bool

property low_marker_color

(self) -> str

property markers

(self) -> bool

property markers_color

(self) -> str

property negative

(self) -> bool

property negative_color

(self) -> str

property series_color

(self) -> str

property type

(self) -> pyopenxlsx._openxlsx.XLSparklineType

class pyopenxlsx.XLSparklineType(*values)

Bases: Enum

Column = 1
Line = 0
Stacked = 2
class pyopenxlsx.XLStreamEmptyRowPolicy(*values)

Bases: Enum

EmitEmptyRows = 1
SkipMissingRows = 0
class pyopenxlsx.XLStreamReadOptions(*args, **kwargs)

Bases: object

property apply_number_formats

(self) -> bool

property empty_rows

(self) -> pyopenxlsx._openxlsx.XLStreamEmptyRowPolicy

class pyopenxlsx.XLStreamReader

Bases: object

close(self) → None
current_row(self) → int
property current_row_index

(self) -> int

current_row_opts(self) → dict

Row attributes for the last returned row.

has_next(self) → bool
property last_error

(self) -> object

next_row(self) → list
next_row_detailed(self) → list

Next row as list of dicts: value, column, optional formula/style_index.

next_row_sparse(self) → list

Next row containing only non-empty cells as list of dicts.

next_row_strings(self) → list

Next row as display strings (respects apply_number_formats when set).

property options

(self) -> pyopenxlsx._openxlsx.XLStreamReadOptions

class pyopenxlsx.XLStreamRowOpts(*args, **kwargs)

Bases: object

property height

(self) -> object

property hidden

(self) -> object

property outline_level

(self) -> object

property style_index

(self) -> object

class pyopenxlsx.XLStreamWriter

Bases: object

Add external hyperlink (written on close).

Add internal workbook hyperlink.

append_row(self, values: object, opts: object | None = None) → None

Append a row. Items may be values, (value, style), (value, style, formula), or dicts.

append_rows(self, rows: collections.abc.Iterable) → None
close(self) → None
flush(self) → None

Alias for close().

freeze_panes(self, top_left_cell: str) → None
freeze_panes(self, cols: int, rows: int) → None

Overloaded function.

  1. freeze_panes(self, top_left_cell: str) -> None

Freeze panes with top_left_cell as first unfrozen cell.

  1. freeze_panes(self, cols: int, rows: int) -> None

Freeze first cols columns and rows rows.

insert_page_break(self, cell_ref: str) → None

Insert page break at cell reference.

property is_active

(self) -> bool

is_stream_active(self) → bool
property last_row

(self) -> int

property max_column

(self) -> int

merge_cells(self, top_left: str, bottom_right: str) → None

Merge a cell range (written on close).

set_auto_filter(self, range: str) → None

Set AutoFilter range (written on close).

set_col_outline_level(self, col: int, level: int) → None

Set column outline level (1-7).

set_col_style(self, min_col: int, max_col: int, style: int) → None

Apply style index to columns [min_col, max_col].

set_col_visible(self, min_col: int, max_col: int, visible: bool) → None

Show or hide columns [min_col, max_col].

set_col_width(self, min_col: int, max_col: int, width: float) → None

Set column width for [min_col, max_col] (1-based, inclusive).

set_row(self, row: int, start_col: int, values: object, opts: object | None = None) → None

Write a row at an explicit 1-based row index (strictly increasing).

set_row_ref(self, cell_ref: str, values: object, opts: object | None = None) → None

Write a row starting at a cell reference such as ‘C10’.

class pyopenxlsx.XLStyle(*args, **kwargs)

Bases: object

class Alignment(*args, **kwargs)

Bases: object

property horizontal

(self) -> pyopenxlsx._openxlsx.XLAlignmentStyle | None

property indent

(self) -> int | None

property text_rotation

(self) -> int | None

property vertical

(self) -> pyopenxlsx._openxlsx.XLAlignmentStyle | None

property wrap_text

(self) -> bool | None

class Border(*args, **kwargs)

Bases: object

property bottom

(self) -> pyopenxlsx._openxlsx.XLStyle.BorderElement

property diagonal

(self) -> pyopenxlsx._openxlsx.XLStyle.BorderElement

property diagonal_down

(self) -> bool | None

property diagonal_up

(self) -> bool | None

property left

(self) -> pyopenxlsx._openxlsx.XLStyle.BorderElement

property right

(self) -> pyopenxlsx._openxlsx.XLStyle.BorderElement

property top

(self) -> pyopenxlsx._openxlsx.XLStyle.BorderElement

class BorderElement(*args, **kwargs)

Bases: object

property color

(self) -> pyopenxlsx._openxlsx.XLColor | None

property style

(self) -> pyopenxlsx._openxlsx.XLLineStyle | None

class Fill(*args, **kwargs)

Bases: object

property bg_color

(self) -> pyopenxlsx._openxlsx.XLColor | None

property fg_color

(self) -> pyopenxlsx._openxlsx.XLColor | None

property pattern

(self) -> pyopenxlsx._openxlsx.XLPatternType | None

class Font(*args, **kwargs)

Bases: object

property bold

(self) -> bool | None

property color

(self) -> pyopenxlsx._openxlsx.XLColor | None

property italic

(self) -> bool | None

property name

(self) -> str | None

property size

(self) -> int | None

property strikethrough

(self) -> bool | None

property underline

(self) -> bool | None

property alignment

(self) -> pyopenxlsx._openxlsx.XLStyle.Alignment

property border

(self) -> pyopenxlsx._openxlsx.XLStyle.Border

property fill

(self) -> pyopenxlsx._openxlsx.XLStyle.Fill

property font

(self) -> pyopenxlsx._openxlsx.XLStyle.Font

property number_format

(self) -> str | None

class pyopenxlsx.XLStyles

Bases: object

borders(self) → pyopenxlsx._openxlsx.XLBorders
cell_formats(self) → pyopenxlsx._openxlsx.XLCellFormats
fills(self) → pyopenxlsx._openxlsx.XLFills
fonts(self) → pyopenxlsx._openxlsx.XLFonts
number_formats(self) → pyopenxlsx._openxlsx.XLNumberFormats
class pyopenxlsx.XLTable(*args, **kwargs)

Bases: object

append_column(self, arg: str, /) → pyopenxlsx._openxlsx.XLTableColumn
column(self, arg: str, /) → pyopenxlsx._openxlsx.XLTableColumn
column(self, arg: int, /) → pyopenxlsx._openxlsx.XLTableColumn
comment(self) → str
display_name(self) → str
name(self) → str
range_reference(self) → str
set_comment(self, arg: str, /) → None
set_display_name(self, arg: str, /) → None
set_name(self, arg: str, /) → None
set_range_reference(self, arg: str, /) → None
set_show_column_stripes(self, arg: bool, /) → None
set_show_first_column(self, arg: bool, /) → None
set_show_header_row(self, arg: bool, /) → None
set_show_last_column(self, arg: bool, /) → None
set_show_row_stripes(self, arg: bool, /) → None
set_show_totals_row(self, arg: bool, /) → None
set_style_name(self, arg: str, /) → None
show_column_stripes(self) → bool
show_first_column(self) → bool
show_header_row(self) → bool
show_last_column(self) → bool
show_row_stripes(self) → bool
show_totals_row(self) → bool
style_name(self) → str
class pyopenxlsx.XLTableColumn

Bases: object

calculated_column_formula(self) → str
id(self) → int
name(self) → str
set_calculated_column_formula(self, arg: str, /) → None
set_name(self, arg: str, /) → None
set_totals_row_formula(self, arg: str, /) → None
set_totals_row_function(self, arg: pyopenxlsx._openxlsx.XLTotalsRowFunction, /) → None
set_totals_row_label(self, arg: str, /) → None
totals_row_formula(self) → str
totals_row_function(self) → pyopenxlsx._openxlsx.XLTotalsRowFunction
totals_row_label(self) → str
class pyopenxlsx.XLTables(*args, **kwargs)

Bases: object

add(self, name: str, range: str) → pyopenxlsx._openxlsx.XLTable
add_range(self, name: str, range: pyopenxlsx._openxlsx.XLCellRange) → pyopenxlsx._openxlsx.XLTable
count(self) → int
get_table(self, arg: str, /) → pyopenxlsx._openxlsx.XLTable
class pyopenxlsx.XLThreadedComment(*args, **kwargs)

Bases: object

property id

(self) -> str

property is_resolved

(self) -> bool

property parent_id

(self) -> str

property person_id

(self) -> str

property ref

(self) -> str

property text

(self) -> str

property valid

(self) -> bool

class pyopenxlsx.XLThreadedComments(*args, **kwargs)

Bases: object

add_comment(self, ref: str, person_id: str, text: str) → pyopenxlsx._openxlsx.XLThreadedComment
add_reply(self, parent_id: str, person_id: str, text: str) → pyopenxlsx._openxlsx.XLThreadedComment
comment(self, ref: str) → pyopenxlsx._openxlsx.XLThreadedComment
delete_comment(self, ref: str) → bool
replies(self, parent_id: str) → list[pyopenxlsx._openxlsx.XLThreadedComment]
class pyopenxlsx.XLTotalsRowFunction(*values)

Bases: Enum

Average = 4
Count = 5
CountNums = 6
Custom = 9
Max = 3
Min = 2
None = 0
StdDev = 7
Sum = 1
Var = 8
class pyopenxlsx.XLTrendlineType(*values)

Bases: Enum

Exponential = 1
Linear = 0
Logarithmic = 2
MovingAverage = 5
Polynomial = 3
Power = 4
class pyopenxlsx.XLUnderlineStyle(*values)

Bases: Enum

Double = 2
None = 0
Single = 1
exception pyopenxlsx.XLValueTypeError

Bases: XLException

class pyopenxlsx.XLVectorShapeOptions(*args, **kwargs)

Bases: object

property arrow_end

(self) -> str

property arrow_start

(self) -> str

property end_col

(self) -> std::optional<unsigned int>

property end_offset_x

(self) -> int

property end_offset_y

(self) -> int

property end_row

(self) -> std::optional<unsigned int>

property fill_color

(self) -> str

property flip_h

(self) -> bool

property flip_v

(self) -> bool

property height

(self) -> int

property horz_align

(self) -> str

property line_color

(self) -> str

property line_dash

(self) -> str

property line_width

(self) -> float

property macro

(self) -> str

property name

(self) -> str

property offset_x

(self) -> int

property offset_y

(self) -> int

property rich_text

(self) -> std::optional<OpenXLSX::XLRichText>

property rotation

(self) -> int

property text

(self) -> str

property type

(self) -> pyopenxlsx._openxlsx.XLVectorShapeType

property vert_align

(self) -> str

property width

(self) -> int

class pyopenxlsx.XLVectorShapeType(*values)

Bases: Enum

Arrow = 5
Cloud = 15
Diamond = 6
Donut = 16
Ellipse = 1
FlowChartData = 24
FlowChartDecision = 22
FlowChartDocument = 23
FlowChartProcess = 21
Heart = 13
Hexagon = 8
LightningBolt = 20
Line = 2
Moon = 19
Parallelogram = 7
Rectangle = 0
Ribbon = 17
RightTriangle = 4
SmileyFace = 14
Star16 = 11
Star24 = 12
Star4 = 9
Star5 = 10
Sun = 18
Triangle = 3
class pyopenxlsx.XLVerticalAlignRunStyle(*values)

Bases: Enum

Baseline = 0
Subscript = 1
Superscript = 2
class pyopenxlsx.XLVmlDrawing

Bases: object

create_shape(self, shape_template: pyopenxlsx._openxlsx.XLShape = <pyopenxlsx._openxlsx.XLShape object at 0x74900f771320>) → pyopenxlsx._openxlsx.XLShape
delete_shape(self, index: int) → bool
delete_shape_by_ref(self, cell_ref: str) → bool
shape(self, index: int) → pyopenxlsx._openxlsx.XLShape
shape_count(self) → int
class pyopenxlsx.XLWorkbook

Bases: object

add_chartsheet(self, sheet_name: str) → None
add_worksheet(self, sheet_name: str) → None
chartsheet(self, sheet_name: str) → pyopenxlsx._openxlsx.XLChartsheet
chartsheet(self, index: int) → pyopenxlsx._openxlsx.XLChartsheet
chartsheet_count(self) → int
chartsheet_exists(self, sheet_name: str) → bool
chartsheet_names(self) → list[str]
clear_active_tab(self) → None
clone_sheet(self, existing_name: str, new_name: str) → None
compact_styles(self) → None

Compact and deduplicate cell formats across all worksheets.

defined_names(self) → pyopenxlsx._openxlsx.XLDefinedNames
delete_named_ranges(self) → None
delete_sheet(self, sheet_name: str) → None
index_of_sheet(self, sheet_name: str) → int
is_protected(self) → bool
protect(self, lock_structure: bool = True, lock_windows: bool = False, password: str = '') → None
set_full_calculation_on_load(self) → None
set_sheet_index(self, sheet_name: str, index: int) → None
sheet(self, index: int) → pyopenxlsx._openxlsx.XLSheet
sheet(self, sheet_name: str) → pyopenxlsx._openxlsx.XLSheet
sheet_count(self) → int
sheet_exists(self, sheet_name: str) → bool
sheet_names(self) → list[str]
type_of_sheet(self, sheet_name: str) → pyopenxlsx._openxlsx.XLSheetType
type_of_sheet(self, index: int) → pyopenxlsx._openxlsx.XLSheetType
unprotect(self) → None
update_sheet_references(self, old_name: str, new_name: str) → None
update_worksheet_dimensions(self) → None
worksheet(self, sheet_name: str) → pyopenxlsx._openxlsx.XLWorksheet
worksheet(self, index: int) → pyopenxlsx._openxlsx.XLWorksheet
worksheet_count(self) → int
worksheet_exists(self, sheet_name: str) → bool
worksheet_names(self) → list[str]
class pyopenxlsx.XLWorksheet

Bases: object

add_chart(self, type: pyopenxlsx._openxlsx.XLChartType, name: str, row: int, col: int, width: int, height: int) → pyopenxlsx._openxlsx.XLChart
add_chart_anchor(self, type: pyopenxlsx._openxlsx.XLChartType, anchor: pyopenxlsx._openxlsx.XLChartAnchor) → pyopenxlsx._openxlsx.XLChart
add_comment(self, cell_ref: str, text: str, author: str = '') → pyopenxlsx._openxlsx.XLThreadedComment

Add a modern threaded comment; returns XLThreadedComment.

add_conditional_formatting(self, sqref: str, rule: pyopenxlsx._openxlsx.XLCfRule) → None
add_conditional_formatting_dxf(self, sqref: str, rule: pyopenxlsx._openxlsx.XLCfRule, dxf: pyopenxlsx._openxlsx.XLDxf) → None
add_image(self, image_data: bytes, extension: str, row: int = 1, col: int = 1, width: float = 0, height: float = 0) → None
add_note(self, cell_ref: str, text: str, author: str = '') → None
add_pivot_slicer(self, cell_reference: str, pivot_table: pyopenxlsx._openxlsx.XLPivotTable, column_name: str, options: pyopenxlsx._openxlsx.XLSlicerOptions = <pyopenxlsx._openxlsx.XLSlicerOptions object at 0x74900f2360b0>) → None
add_pivot_table(self, options: pyopenxlsx._openxlsx.XLPivotTableOptions) → pyopenxlsx._openxlsx.XLPivotTable
add_reply(self, parent_id: str, text: str, author: str = '') → pyopenxlsx._openxlsx.XLThreadedComment
add_scaled_image(self, name: str, data: str, row: int, col: int, scaling_factor: float = 1.0) → None
add_shape(self, cell_reference: str, options: pyopenxlsx._openxlsx.XLVectorShapeOptions) → None
add_sort_condition(self, ref: str, col_id: int, descending: bool = False) → None
add_sparkline(self, location: str, data_range: str, type: pyopenxlsx._openxlsx.XLSparklineType = XLSparklineType.Line) → None
add_sparkline(self, location: str, data_range: str, options: pyopenxlsx._openxlsx.XLSparklineOptions) → None
add_table_slicer(self, cell_reference: str, table: pyopenxlsx._openxlsx.XLTable, column_name: str, options: pyopenxlsx._openxlsx.XLSlicerOptions = <pyopenxlsx._openxlsx.XLSlicerOptions object at 0x74900f236010>) → None
add_threaded_comment(self, cell_ref: str, text: str, author: str = '') → pyopenxlsx._openxlsx.XLThreadedComment
add_threaded_reply(self, parent_id: str, text: str, author: str = '') → pyopenxlsx._openxlsx.XLThreadedComment
append_row(self, values: collections.abc.Sequence) → None
apply_auto_filter(self) → None
auto_filter(self) → str
auto_filter_allowed(self) → bool
auto_fit_column(self, column_number: int) → None
autofilter_object(self) → pyopenxlsx._openxlsx.XLAutoFilter
cell(self, arg: str, /) → pyopenxlsx._openxlsx.XLCell
cell(self, arg0: int, arg1: int, /) → pyopenxlsx._openxlsx.XLCell
clear_all_conditional_formatting(self) → None
clear_auto_filter(self) → None
clear_panes(self) → None
clear_password(self) → None
clear_sheet_protection(self) → bool
column(self, arg: int, /) → pyopenxlsx._openxlsx.XLColumn
column(self, arg: str, /) → pyopenxlsx._openxlsx.XLColumn
column_count(self) → int
column_format(self, arg: str, /) → int
comments(self) → pyopenxlsx._openxlsx.XLComments
conditional_formats(self) → pyopenxlsx._openxlsx.XLConditionalFormats
data_validations(self) → pyopenxlsx._openxlsx.XLDataValidations
delete_column(self, col_number: int, count: int = 1) → bool
delete_columns_allowed(self) → bool
delete_comment(self, cell_ref: str) → None
delete_note(self, cell_ref: str) → None
delete_pivot_table(self, name: str) → bool
delete_row(self, row_number: int) → bool
delete_row(self, row_number: int, count: int) → bool
delete_rows_allowed(self) → bool
delete_slicer(self, name: str) → None

Delete a slicer by name and clean up orphan caches.

drawing(self) → pyopenxlsx._openxlsx.XLDrawing
find_cell(self, ref: str) → OpenXLSX::XLCellAssignable
find_cell(self, row: int, col: int) → OpenXLSX::XLCellAssignable
fit_to_pages(self, fit_to_width: int, fit_to_height: int) → None
format_cells_allowed(self) → bool
format_columns_allowed(self) → bool
format_rows_allowed(self) → bool
freeze_panes(self, column: int, row: int) → None
freeze_panes(self, cellRef: str) → None
get_cell_value(self, row: int, col: int) → object

Get a single cell’s value directly without creating a Cell object

get_range_data(self, start_row: int, start_col: int, end_row: int, end_col: int) → list

Get a range of cells as list[list[Any]] - optimized bulk read for specific range

get_range_values(self, start_row: int, start_col: int, end_row: int, end_col: int) → numpy.ndarray[dtype=float64, shape=(*, *)]

Read a range of numeric cells into a 2D numpy array of doubles

get_row_values(self, row: int) → list

Get a single row’s values as list[Any]

get_rows_data(self) → list

Get all rows data as list[list[Any]] - optimized for bulk read

group_columns(self, col_first: int, col_last: int, outline_level: int = 1, collapsed: bool = False) → None
group_rows(self, row_first: int, row_last: int, outline_level: int = 1, collapsed: bool = False) → None
has_auto_filter(self) → bool
has_comments(self) → bool
has_drawing(self) → bool
has_panes(self) → bool
has_relationships(self) → bool
has_tables(self) → bool
has_threaded_comments(self) → bool
has_vml_drawing(self) → bool
images(self) → list[pyopenxlsx._openxlsx.XLDrawingItem]
index(self) → int
insert_col_break(self, col: int) → None
insert_column(self, col_number: int, count: int = 1) → bool
insert_columns_allowed(self) → bool
insert_image(self, cell_reference: str, image_path: str) → None
insert_image_bytes(self, cell_reference: str, image_data: bytes, options: object | None = None) → None

Insert an image from raw bytes at the given cell.

insert_image_opt(self, cell_reference: str, image_path: str, options: pyopenxlsx._openxlsx.XLImageOptions) → None
insert_row(self, row_number: int, count: int = 1) → bool
insert_row_break(self, row: int) → None
insert_rows_allowed(self) → bool
is_active(self) → bool
is_streamed_sheet(self) → bool
last_cell(self) → pyopenxlsx._openxlsx.XLCellReference
merge_cells(self, rangeReference: str, emptyHiddenCells: bool = False) → None
merges(self) → pyopenxlsx._openxlsx.XLMergeCells
name(self) → str
objects_protected(self) → bool
page_margins(self) → pyopenxlsx._openxlsx.XLPageMargins
page_setup(self) → pyopenxlsx._openxlsx.XLPageSetup
password_hash(self) → str
password_is_set(self) → bool
peek_cell(self, ref: str) → std::optional<OpenXLSX::XLCell>
peek_cell(self, row: int, col: int) → std::optional<OpenXLSX::XLCell>
pivot_tables(self) → list[pyopenxlsx._openxlsx.XLPivotTable]
pivot_tables_allowed(self) → bool
print_options(self) → pyopenxlsx._openxlsx.XLPrintOptions
protect(self, options: pyopenxlsx._openxlsx.XLSheetProtectionOptions, password: str = '') → bool
protect_objects(self, set: bool = True) → None
protect_scenarios(self, set: bool = True) → None
protect_sheet(self, set: bool = True) → None
range(self, arg: str, /) → pyopenxlsx._openxlsx.XLCellRange
range(self, arg0: str, arg1: str, /) → pyopenxlsx._openxlsx.XLCellRange
range_used(self) → pyopenxlsx._openxlsx.XLCellRange

Used range of the worksheet.

remove_col_break(self, col: int) → None
remove_conditional_formatting(self, sqref: str) → None
remove_row_break(self, row: int) → None
row(self, row_number: int) → pyopenxlsx._openxlsx.XLRow
row_count(self) → int
row_format(self, arg: int, /) → int
rows(self) → pyopenxlsx._openxlsx.XLRowRange
rows(self, row_count: int) → pyopenxlsx._openxlsx.XLRowRange
rows(self, first_row: int, last_row: int) → pyopenxlsx._openxlsx.XLRowRange
scenarios_protected(self) → bool
select_locked_cells_allowed(self) → bool
select_unlocked_cells_allowed(self) → bool
set_active(self) → bool
set_auto_filter(self, range: str) → None
set_auto_filter_allowed(self, set: bool = True) → None
set_cell_value(self, row: int, col: int, value: object) → None

Set a cell’s value directly without creating a Cell object. 10-20x faster than ws.cell(row, col).value = val for bulk operations

set_cells_batch(self, cells: list) → None

Batch set multiple cell values: [(row, col, value), …]. Efficient for non-contiguous cell updates

set_column_format(self, column: str, cellFormatIndex: int) → bool
set_column_format(self, column: int, cellFormatIndex: int) → bool
set_delete_columns_allowed(self, set: bool = True) → None
set_delete_rows_allowed(self, set: bool = True) → None
set_format_cells_allowed(self, set: bool = True) → None
set_format_columns_allowed(self, set: bool = True) → None
set_format_rows_allowed(self, set: bool = True) → None
set_index(self, arg: int, /) → None
set_insert_columns_allowed(self, set: bool = True) → None
set_insert_rows_allowed(self, set: bool = True) → None
set_name(self, arg: str, /) → None
set_password(self, password: str) → None
set_pivot_tables_allowed(self, set: bool = True) → None
set_print_area(self, sqref: str) → None
set_print_title_cols(self, first_col: int, last_col: int) → None
set_print_title_rows(self, first_row: int, last_row: int) → None
set_row_format(self, row: int, cellFormatIndex: int) → bool
set_select_locked_cells_allowed(self, set: bool = True) → None
set_select_unlocked_cells_allowed(self, set: bool = True) → None
set_sheet_view_mode(self, mode: str) → None
set_show_grid_lines(self, show: bool) → None
set_show_row_col_headers(self, show: bool) → None
set_sort_allowed(self, set: bool = True) → None
set_visibility(self, arg: pyopenxlsx._openxlsx.XLSheetState, /) → None
set_zoom(self, scale: int) → None
sheet_protected(self) → bool
sheet_protection_summary(self) → str
sheet_view_mode(self) → str
show_grid_lines(self) → bool
show_row_col_headers(self) → bool
slicers(self) → pyopenxlsx._openxlsx.XLSlicerCollection

Slicer collection for this worksheet.

sort_allowed(self) → bool
split_panes(self, xSplit: float, ySplit: float, topLeftCell: str = '', activePane: pyopenxlsx._openxlsx.XLPane = XLPane.BottomRight) → None
stream_reader(self, options: object | None = None) → pyopenxlsx._openxlsx.XLStreamReader

Create a stream reader. Pass XLStreamReadOptions for empty-row / number-format policy.

stream_writer(self, use_shared_strings: bool = False, max_unique_strings: int = 100000) → pyopenxlsx._openxlsx.XLStreamWriter

Start a stream writer. Optionally enable shared-string caching.

tables(self) → pyopenxlsx._openxlsx.XLTables
threaded_comments(self) → pyopenxlsx._openxlsx.XLThreadedComments
unmerge_cells(self, rangeReference: str) → None
update_dimension(self) → None
update_sheet_name(self, old_name: str, new_name: str) → None
visibility(self) → pyopenxlsx._openxlsx.XLSheetState
vml_drawing(self) → pyopenxlsx._openxlsx.XLVmlDrawing
write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=float64, order='C', device='cpu']) → None
write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=float32, order='C', device='cpu']) → None
write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=int64, order='C', device='cpu']) → None
write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=int32, order='C', device='cpu']) → None
write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=bool, order='C', device='cpu']) → None

Overloaded function.

  1. write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=float64, order='C', device='cpu']) -> None

Write a 2D numpy array or buffer to a worksheet range

  1. write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=float32, order='C', device='cpu']) -> None

  2. write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=int64, order='C', device='cpu']) -> None

  3. write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=int32, order='C', device='cpu']) -> None

  4. write_range_data(self, start_row: int, start_col: int, data: ndarray[dtype=bool, order='C', device='cpu']) -> None

write_row_data(self, row: int, start_col: int, values: list) → None

Write a single row of Python data

write_rows_data(self, start_row: int, start_col: int, rows: list) → None

Write a 2D Python list to a worksheet range. Optimized for any Python data (strings, mixed types). For pure numeric data, use write_range_data with numpy for best performance

zoom(self) → int
pyopenxlsx.add_chart(worksheet, type_name, name, *, row=5, col=5, width=400, height=300, title=None, series_ref=None, series_name='', cats_ref=None, series=None, legend=None, wrap=True)[source]

Create a chart with optional title, series, and legend.

Parameters:

wrap (bool) – When True (default), return a Chart wrapper; when False, return the native chart object (legacy behaviour).

Return type:

Any

pyopenxlsx.calculation_options(*, write_back=None, use_defined_names=None, **extra)[source]

Build XLCalculationOptions from keyword flags.

Unknown keys are applied as setattr on the options object when present.

Return type:

XLCalculationOptions

pyopenxlsx.chart_type(name)[source]

Resolve a chart type from XLChartType or a case-insensitive name.

Examples: "bar", "Column", "line", "pie".

Return type:

XLChartType

pyopenxlsx.is_date_format(c_format)[source]

Returns True if the given format code or id implies a date/time.

Return type:

bool

Add a hyperlink and optionally set the cell display text.

Parameters:
  • worksheet (Any) – High-level Worksheet.

  • cell_ref (str) – Anchor cell (e.g. "A1").

  • target (str) – URL or internal location ("Sheet2!A1").

  • text (Optional[str]) – If given, write this as the cell value.

  • tooltip (str) – Optional tooltip string.

  • internal (Optional[bool]) – Force internal vs external. When None, infer from target (URLs → external, otherwise internal).

Return type:

None

pyopenxlsx.load_workbook(filename, password=None)[source]
Return type:

Workbook

async pyopenxlsx.load_workbook_async(filename, password=None)[source]
Return type:

Workbook

pyopenxlsx.pivot_show_values_as(val=None)[source]

Resolve ShowValuesAs configuration from enum, string, tuple, or dict.

Return type:

XLPivotShowValuesAsOptions

pyopenxlsx.pivot_subtotal(name)[source]

Resolve a subtotal from enum or friendly name (sum, count, …).

Return type:

XLPivotSubtotal

pyopenxlsx.pivot_table(name, source_range, target_cell='A1', *, rows=None, columns=None, data=None, filters=None, style=None, subtotal='sum', show_values_as=None)[source]

Convenience constructor with common fields pre-filled.

Return type:

PivotTableBuilder