API Reference
This section contains the automatically generated API documentation extracted from the source code.
- class pyopenxlsx.Alignment(horizontal=None, vertical=None, wrap_text=False)[source]
Bases:
object- horizontal()[source]
- Return type:
Optional[XLAlignmentStyle]
- vertical()[source]
- Return type:
Optional[XLAlignmentStyle]
- class pyopenxlsx.Border(left=None, right=None, top=None, bottom=None, diagonal=None, outline=None)[source]
Bases:
object
- class pyopenxlsx.Cell(raw_cell, worksheet=None)[source]
Bases:
objectRepresents an Excel cell.
Uses weak references to worksheet and workbook to avoid circular references that could delay garbage collection.
- 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.Column(raw_column, worksheet=None)[source]
Bases:
objectRepresents an Excel column.
Uses weak references to avoid circular references with Worksheet/Workbook.
- property style_index
- property width
- class pyopenxlsx.DataValidation(raw_dv, worksheet=None)[source]
Bases:
objectRepresents an Excel data validation rule.
- 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_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:
objectManages 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:
- class pyopenxlsx.Fill(pattern_type=XLPatternType.Solid, color=None, background_color=None)[source]
Bases:
object
- class pyopenxlsx.Font(name='Arial', size=11, bold=False, italic=False, color=None)[source]
Bases:
object
- class pyopenxlsx.Formula(raw_cell)[source]
Bases:
objectWrapper for Excel formulas. Allows interacting with the formula assigned to a cell.
- property text
Get or set the formula string.
- 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:
objectRepresents the page margins of a worksheet. Values are in inches.
- property bottom
- property header
- property left
- property right
- property top
- class pyopenxlsx.PageSetup(raw_setup, worksheet=None)[source]
Bases:
objectRepresents 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.PrintOptions(raw_options, worksheet=None)[source]
Bases:
objectRepresents 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.
- pyopenxlsx.PythonMergeCells
alias of
MergeCells
- class pyopenxlsx.Range(raw_range, worksheet=None)[source]
Bases:
objectRepresents a range of Excel cells.
Uses weak references to avoid circular references with Worksheet.
- property address
- property num_columns
- property num_rows
- class pyopenxlsx.Side(style=XLLineStyle.Thin, color=None)[source]
Bases:
object
- 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:
objectRepresents an Excel Table (ListObject).
- 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:
objectRepresents an Excel workbook.
Uses WeakValueDictionary for worksheet caching to allow garbage collection of Worksheet objects when they are no longer referenced elsewhere.
- property active
- add_style(font=None, fill=None, border=None, alignment=None, number_format=None, protection=None)[source]
- Return type:
int
- async add_style_async(font=None, fill=None, border=None, alignment=None, number_format=None, protection=None)[source]
- Return type:
int
- property custom_properties
Get the custom document properties.
- property defined_names
Access the collection of defined names (named ranges) in the workbook.
- 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.
- property properties
- property sheetnames
- property styles
- property workbook
- class pyopenxlsx.Worksheet(raw_sheet, workbook=None)[source]
Bases:
objectRepresents an Excel worksheet.
Uses WeakValueDictionary for cell caching to allow garbage collection of Cell objects when they are no longer referenced elsewhere.
- add_hyperlink(cell_ref, url, tooltip='')[source]
Add an external hyperlink to a cell.
- Parameters:
cell_ref (
str) – Cell reference (e.g., ‘A1’).url (
str) – URL of the hyperlink.tooltip (
str) – Optional tooltip text.
- Return type:
None
- add_image(img_path, anchor='A1', width=None, height=None)[source]
Add an image to the worksheet.
- Parameters:
img_path (
str) – Path to the image file.anchor (
str) – Cell reference for the top-left corner of the image (e.g., ‘A1’).width (
Optional[int]) – Width of the image in pixels. If None, it will try to get it from the image.height (
Optional[int]) – Height of the image in pixels. If None, it will try to get it from the image.
- Return type:
None
- add_internal_hyperlink(cell_ref, location, tooltip='')[source]
Add an internal hyperlink (to another sheet or range) to a cell.
- Parameters:
cell_ref (
str) – Cell reference (e.g., ‘A1’).location (
str) – Destination in the workbook (e.g., ‘Sheet2!A1’).tooltip (
str) – Optional tooltip text.
- Return type:
None
- add_shape(row=1, col=1, shape_type='Rectangle', **kwargs)[source]
Add a vector shape to the worksheet.
- Return type:
None
- Args:
row (int): The 1-based row index to place the top-left corner. col (int): The 1-based column index to place the top-left corner. shape_type (str): The type of the shape (e.g., “Rectangle”, “Ellipse”, “Arrow”). **kwargs: Shape options including:
name (str): Shape name.
text (str): Text inside the shape.
fill_color (str): ARGB fill color.
line_color (str): ARGB line color.
line_width (float): Line width.
width (int): Width in pixels.
height (int): Height in pixels.
offset_x (int): Offset X in pixels.
offset_y (int): Offset Y in pixels.
end_row (int): End row for two-cell anchor.
end_col (int): End column for two-cell anchor.
end_offset_x (int): End offset X.
end_offset_y (int): End offset Y.
rotation (int): Rotation in degrees.
flip_h (bool): Flip horizontally.
flip_v (bool): Flip vertically.
line_dash (str): Line dash style (e.g., “dash”, “sysDash”).
arrow_start (str): Arrow start style.
arrow_end (str): Arrow end style.
horz_align (str): Horizontal text alignment (“l”, “ctr”, “r”).
vert_align (str): Vertical text alignment (“t”, “ctr”, “b”).
- add_sparkline(location, data_range, sparkline_type=None, options=None)[source]
Add a sparkline to the worksheet.
- add_table(name, range_string)[source]
Add a new table to the worksheet.
- Parameters:
name (
str) – Table name (no spaces).range_string (
str) – Range reference (e.g., ‘A1:C10’).
- Return type:
Any- Returns:
Table object.
- property auto_filter
Get the AutoFilter object for the worksheet to manage filters. Returns None if no AutoFilter is set.
- property data_validations
Get the DataValidations object for this worksheet to manage data validation rules.
- 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.
- freeze_panes(row_or_ref, col=None)[source]
Freeze the worksheet panes.
- Parameters:
row_or_ref (
Union[int,str]) – Row number (1-indexed) or a cell reference string (e.g., ‘B2’).col (
Optional[int]) – Column number (1-indexed). Only used if row_or_ref is an int.
- Return type:
None
- get_cell_value(row, column)[source]
Get a single cell’s value directly without creating a Cell object.
This is faster than ws.cell(row, col).value when you only need the value and don’t need to modify the cell or access other properties.
- Parameters:
row (
int) – Row number (1-indexed)column (
int) – Column number (1-indexed)
- Returns:
The cell’s value (str, int, float, bool, or None)
- get_range_data(start_row, start_col, end_row, end_col)[source]
Get a range of cells as list[list[Any]].
This is an optimized bulk read method for reading a specific range of cells without creating intermediate Cell objects.
- Parameters:
start_row (
int) – Starting row number (1-indexed)start_col (
int) – Starting column number (1-indexed)end_row (
int) – Ending row number (1-indexed, inclusive)end_col (
int) – Ending column number (1-indexed, inclusive)
- Returns:
list[list[Any]] - Cell values in the range
- async get_range_data_async(start_row, start_col, end_row, end_col)[source]
Async version of get_range_data().
- get_range_values(start_row, start_col, end_row, end_col)[source]
Read a range of numeric cells into a 2D numpy array of doubles.
This is a high-performance method for reading large amounts of numeric data.
- Parameters:
start_row (
int) – Starting row number (1-indexed)start_col (
int) – Starting column number (1-indexed)end_row (
int) – Ending row number (1-indexed, inclusive)end_col (
int) – Ending column number (1-indexed, inclusive)
- Returns:
2D numpy array (float64)
- async get_range_values_async(start_row, start_col, end_row, end_col)[source]
Async version of get_range_values().
- get_row_values(row)[source]
Get a single row’s values as list[Any].
- Parameters:
row (
int) – Row number (1-indexed)- Returns:
list[Any] - Cell values for the specified row
- get_rows_data()[source]
Get all rows data as list[list[Any]].
This is an optimized bulk read method that returns all cell values without creating intermediate Cell objects. Much faster than iterating through ws.rows for large worksheets.
- Return type:
List[List[Any]]- Returns:
list[list[Any]] - All cell values, with None for empty cells
- property has_drawing
Check if the worksheet has a drawing (images, charts, etc.).
- property has_panes
Check if the worksheet has frozen or split panes.
- 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_row_values()[source]
Iterate over rows, yielding each row’s values as list[Any].
This is an optimized iterator that yields row values directly without creating Cell objects. Use this for efficient row-by-row processing of large worksheets.
- Yields:
list[Any] - Cell values for each row
- property max_column
- property max_row
- property merges
- property name
Alias for title to maintain compatibility and prevent dynamic attribute bugs.
- property page_margins
Get the PageMargins object for this worksheet.
- property page_setup
Get the PageSetup object for this worksheet.
- property print_options
Get the PrintOptions object for this worksheet.
- protect(password=None, sheet=True, objects=False, scenarios=False, insert_columns=False, insert_rows=False, insert_hyperlinks=False, delete_columns=False, delete_rows=False, select_locked_cells=True, select_unlocked_cells=True, auto_filter=False, sort=False, pivot_tables=False, format_cells=False, format_columns=False, format_rows=False)[source]
Protect the worksheet.
- Return type:
None
- async protect_async(password=None, sheet=True, objects=False, scenarios=False, insert_columns=False, insert_rows=False, insert_hyperlinks=False, delete_columns=False, delete_rows=False, select_locked_cells=True, select_unlocked_cells=True, auto_filter=False, sort=False, pivot_tables=False, format_cells=False, format_columns=False, format_rows=False)[source]
- Return type:
None
- property protection
Get the protection status of the worksheet.
- read_dataframe(start_row=1, start_col=1, end_row=None, end_col=None, header=True)[source]
Import a range from the worksheet to a pandas DataFrame.
- Return type:
Any
- Args:
start_row (int): The starting 1-based row index. start_col (int): The starting 1-based column index. end_row (int): The ending 1-based row index. If None, uses max_row. end_col (int): The ending 1-based column index. If None, uses max_column. header (bool): Whether the first row of the range should be used as column names.
- Returns:
A pandas DataFrame.
- async read_dataframe_async(start_row=1, start_col=1, end_row=None, end_col=None, header=True)[source]
- Return type:
Any
- property rows
- set_cell_value(row, column, value)[source]
Set a cell’s value directly without creating a Cell object.
This is 10-20x faster than ws.cell(row, col).value = val for bulk operations as it bypasses: - Python Cell wrapper object creation - WeakValueDictionary cache operations - Multiple Python/C++ boundary crossings
- Parameters:
row (
int) – Row number (1-indexed)column (
int) – Column number (1-indexed)value – Value to set (str, int, float, bool, or None)
Example:
# Fast bulk write for r in range(1, 1001): for c in range(1, 51): ws.set_cell_value(r, c, f"R{r}C{c}")
- set_cells(cells)[source]
Batch set multiple cell values efficiently.
This is optimal for non-contiguous cell updates where you can’t use write_rows() or write_range().
- Parameters:
cells (
Iterable[Tuple[int,int,Any]]) – Iterable of (row, col, value) tuples- Return type:
None
Example:
ws.set_cells([ (1, 1, "Header A"), (1, 5, "Header B"), (10, 3, 42.5), (20, 1, "Footer"), ])
- set_print_title_cols(first_col, last_col)[source]
Set the columns to repeat at left on printed pages.
- property sheet_state
- split_panes(x_split, y_split, top_left_cell='', active_pane='bottomRight')[source]
Split the worksheet panes at given pixel coordinates.
- Parameters:
x_split (
float) – Horizontal split position in 1/20th of a point.y_split (
float) – Vertical split position in 1/20th of a point.top_left_cell (
str) – Cell address of the top-left cell in the bottom-right pane.active_pane (
str) – The pane that is active (‘bottomRight’, ‘topRight’, ‘bottomLeft’, ‘topLeft’).
- Return type:
None
- property table
Get the first Table object for this worksheet. If no table exists, one is created automatically with default name ‘Table1’ and range ‘A1:A1’. Note: OpenXLSX now supports multiple tables per worksheet. Use the ‘tables’ property to access all tables or ‘add_table’ to create new ones.
- property tables
Get the collection of tables in this worksheet.
- property title
- write_dataframe(df, start_row=1, start_col=1, header=True, index=False, column_styles=None)[source]
Export a pandas DataFrame to the worksheet.
- Return type:
None
- Args:
df: The pandas DataFrame. start_row (int): The starting 1-based row index. start_col (int): The starting 1-based column index. header (bool): Whether to write the DataFrame columns as a header row. index (bool): Whether to write the DataFrame index as the first column(s). column_styles (dict): Optional dictionary mapping column names or 0-based indices to style IDs.
e.g. {“Date”: date_style_id}
- async write_dataframe_async(df, start_row=1, start_col=1, header=True, index=False)[source]
- Return type:
None
- write_range(start_row, start_col, data)[source]
Write a 2D numpy array or any object supporting the buffer protocol to a worksheet range.
This is a high-performance method that avoids Python-level loops and object creation.
- Parameters:
start_row (
int) – Starting row number (1-indexed)start_col (
int) – Starting column number (1-indexed)data – 2D numpy array or buffer-compatible object
- write_row(row, values, start_col=1)[source]
Write a single row of Python data.
- Parameters:
row (
int) – Row number (1-indexed)values – List/tuple of values for the row
start_col (
int) – Starting column number (1-indexed), defaults to 1
- Example:
ws.write_row(1, [“Name”, “Age”, “City”])
- write_rows(start_row, data, start_col=1)[source]
Write a 2D Python list to a worksheet range.
This is optimized for any Python data (strings, mixed types, etc.). For pure numeric data, use write_range() with numpy for best performance.
- Parameters:
start_row (
int) – Starting row number (1-indexed)data – 2D list/tuple of values [[row1_val1, row1_val2, …], [row2_val1, …], …]
start_col (
int) – Starting column number (1-indexed), defaults to 1
Example:
data = [ ["Name", "Age", "City"], ["Alice", 30, "New York"], ["Bob", 25, "Los Angeles"], ] ws.write_rows(1, data)
- 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.XLBorder(*args, **kwargs)
Bases:
object- bottom(self) pyopenxlsx._openxlsx.XLLine
- diagonal(self) pyopenxlsx._openxlsx.XLLine
- left(self) pyopenxlsx._openxlsx.XLLine
- 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_left(self, lineStyle: pyopenxlsx._openxlsx.XLLineStyle, lineColor: pyopenxlsx._openxlsx.XLColor, lineTint: float = 0.0) bool
- 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
- top(self) pyopenxlsx._openxlsx.XLLine
- 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 0x7f78e87d1550>, styleEntriesPrefix: str = '\n\t\t') int
- 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
- 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_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 0x7f78e8962be0>, styleEntriesPrefix: str = '\n\t\t') int
- class pyopenxlsx.XLCellRange
Bases:
object- address(self) str
- num_columns(self) int
- num_rows(self) int
- class pyopenxlsx.XLCellReference(*args, **kwargs)
Bases:
object- address(self) str
- column(self) int
- row(self) int
- class pyopenxlsx.XLColor(*args, **kwargs)
Bases:
object- alpha(self) int
- blue(self) int
- green(self) int
- hex(self) str
- red(self) int
- 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.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
- ExternalLink = 5
- Hyperlink = 22
- Relationships = 1
- 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.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.XLDateTime(*args, **kwargs)
Bases:
object- as_datetime(self) object
- serial(self) float
- class pyopenxlsx.XLDefinedName(*args, **kwargs)
Bases:
object- comment(self) str
- local_sheet_id(self) object
- name(self) str
- refers_to(self) str
- valid(self) bool
- 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
- class pyopenxlsx.XLDocument(*args, **kwargs)
Bases:
object- app_properties(self) pyopenxlsx._openxlsx.XLAppProperties
- content_types(self) pyopenxlsx._openxlsx.XLContentTypes
- core_properties(self) pyopenxlsx._openxlsx.XLProperties
- custom_property(self, name: str) str
Get a custom document property by name
- delete_property(self, arg: pyopenxlsx._openxlsx.XLProperty, /) None
- 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’).
- has_archive_entry(self, path: str) bool
Check if the underlying zip archive contains an entry with the given path.
- has_macro(self) bool
- is_open(self) bool
- name(self) str
- path(self) str
- persons(self) pyopenxlsx._openxlsx.XLPersons
- property(self, arg: pyopenxlsx._openxlsx.XLProperty, /) str
- save_as(self, arg0: str, arg1: bool, /) None
- save_as(self, arg0: str, arg1: bool, arg2: str, /) None
- set_property(self, arg0: pyopenxlsx._openxlsx.XLProperty, arg1: str, /) None
- styles(self) pyopenxlsx._openxlsx.XLStyles
- 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 0x7f78e8878030>) 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 0x7f78e88f03b0>) None
- image(self, index: int) pyopenxlsx._openxlsx.XLDrawingItem
- image_count(self) int
- 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.XLFills
Bases:
object- count(self) int
- create(self, copyFrom: pyopenxlsx._openxlsx.XLFill = <pyopenxlsx._openxlsx.XLFill object at 0x7f78e87d1670>, styleEntriesPrefix: str = '\n\t\t') int
- fill_by_index(self, arg: int, /) pyopenxlsx._openxlsx.XLFill
- 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.XLFonts
Bases:
object- count(self) int
- create(self, copyFrom: pyopenxlsx._openxlsx.XLFont = <pyopenxlsx._openxlsx.XLFont object at 0x7f78e87d0d30>, styleEntriesPrefix: str = '\n\t\t') int
- font_by_index(self, arg: int, /) pyopenxlsx._openxlsx.XLFont
- 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.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.XLMergeCells
Bases:
object- append_merge(self, arg: str, /) int
- count(self) int
- 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 0x7f78e87d0cb0>, 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.XLPane(*values)
Bases:
Enum- BottomLeft = 2
- BottomRight = 0
- TopLeft = 3
- TopRight = 1
- 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.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
- Subject = 1
- Title = 0
- 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
- 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.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
- 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.XLStreamReader
Bases:
object- current_row(self) int
- property current_row_index
(self) -> int
- has_next(self) bool
- next_row(self) list
- 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.XLVerticalAlignRunStyle(*values)
Bases:
Enum- Baseline = 0
- Subscript = 1
- Superscript = 2
- class pyopenxlsx.XLWorkbook
Bases:
object- defined_names(self) pyopenxlsx._openxlsx.XLDefinedNames
- sheet_count(self) int
- sheet_exists(self, arg: str, /) bool
- worksheet(self, arg: str, /) pyopenxlsx._openxlsx.XLWorksheet
- worksheet_names(self) list[str]