openpyxl.worksheet.dimensions module

class openpyxl.worksheet.dimensions.ColumnDimension(worksheet, index='A', width=13, bestFit=False, hidden=False, outlineLevel=0, outline_level=None, collapsed=False, style=None, min=None, max=None, customWidth=False, visible=None, auto_size=None)[source]

Bases: Dimension

Information about the display properties of a column.

auto_size

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

bestFit

Values must be of type <class ‘bool’>

collapsed

Values must be of type <class ‘bool’>

property customWidth

Always true if there is a width for the column

index

Values must be of type <class ‘str’>

max

Values must be of type <class ‘int’>

min

Values must be of type <class ‘int’>

parent
property range

Return the range of cells actually covered

reindex()[source]

Set boundaries for column definition

to_tree()[source]
width

Values must be of type <class ‘float’>

class openpyxl.worksheet.dimensions.Dimension(index, hidden, outlineLevel, collapsed, worksheet, visible=True, style=None)[source]

Bases: Strict, StyleableObject

Information about the display properties of a row or column.

collapsed

Values must be of type <class ‘bool’>

hidden

Values must be of type <class ‘bool’>

index

Values must be of type <class ‘int’>

outlineLevel

Values must be of type <class ‘int’>

outline_level

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

parent
style

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

class openpyxl.worksheet.dimensions.DimensionHolder(worksheet, reference='index', default_factory=None)[source]

Bases: BoundDictionary

Allow columns to be grouped

group(start, end=None, outline_level=1, hidden=False)[source]

allow grouping a range of consecutive rows or columns together

Parameters:
  • start – first row or column to be grouped (mandatory)

  • end – last row or column to be grouped (optional, default to start)

  • outline_level – outline level

  • hidden – should the group be hidden on workbook open or not

to_tree()[source]
class openpyxl.worksheet.dimensions.RowDimension(worksheet, index=0, ht=None, customHeight=None, s=None, customFormat=None, hidden=False, outlineLevel=0, outline_level=None, collapsed=False, visible=None, height=None, r=None, spans=None, thickBot=None, thickTop=None, **kw)[source]

Bases: Dimension

Information about the display properties of a row.

property customFormat

Always true if there is a style for the row

property customHeight

Always true if there is a height for the row

height

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

ht

Values must be of type <class ‘float’>

parent
r

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

s

Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)

thickBot

Values must be of type <class ‘bool’>

thickTop

Values must be of type <class ‘bool’>

class openpyxl.worksheet.dimensions.SheetDimension(ref=None)[source]

Bases: Serialisable

property boundaries
ref

Values must be of type <class ‘str’>

tagname = 'dimension'
class openpyxl.worksheet.dimensions.SheetFormatProperties(baseColWidth=8, defaultColWidth=None, defaultRowHeight=15, customHeight=None, zeroHeight=None, thickTop=None, thickBottom=None, outlineLevelRow=None, outlineLevelCol=None)[source]

Bases: Serialisable

baseColWidth

Values must be of type <class ‘int’>

customHeight

Values must be of type <class ‘bool’>

defaultColWidth

Values must be of type <class ‘float’>

defaultRowHeight

Values must be of type <class ‘float’>

outlineLevelCol

Values must be of type <class ‘int’>

outlineLevelRow

Values must be of type <class ‘int’>

tagname = 'sheetFormatPr'
thickBottom

Values must be of type <class ‘bool’>

thickTop

Values must be of type <class ‘bool’>

zeroHeight

Values must be of type <class ‘bool’>