openpyxl.cell.cell module
Manage individual cells in a spreadsheet.
The Cell class is required to know its value and type, display options, and any other features of an Excel cell. Utilities for referencing cells using Excel’s ‘A1’ column/row nomenclature are also provided.
- class openpyxl.cell.cell.Cell(worksheet, row=None, column=None, value=None, style_array=None)[source]
 Bases:
StyleableObjectDescribes cell associated properties.
Properties of interest include style, type, value, and address.
- property base_date
 
- property col_idx
 The numerical index of the column
- column
 Column number of this cell (1-based)
- property column_letter
 
- property comment
 Returns the comment associated with this cell
- Type:
 openpyxl.comments.Comment
- property coordinate
 This cell’s coordinate (ex. ‘A5’)
- data_type
 
- property encoding
 
- property hyperlink
 Return the hyperlink target or an empty string
- property internal_value
 Always returns the value for excel.
- property is_date
 True if the value is formatted as a date
- Type:
 bool
- offset(row=0, column=0)[source]
 Returns a cell location relative to this cell.
- Parameters:
 row (int) – number of rows to offset
column (int) – number of columns to offset
- Return type:
 openpyxl.cell.Cell
- parent
 
- row
 Row number of this cell (1-based)
- property value
 Get or set the value held in the cell.
- Type:
 depends on the value (string, float, int or
datetime.datetime)
- class openpyxl.cell.cell.MergedCell(worksheet, row=None, column=None)[source]
 Bases:
StyleableObjectDescribes the properties of a cell in a merged cell and helps to display the borders of the merged cell.
The value of a MergedCell is always None.
- column
 
- comment = None
 
- property coordinate
 This cell’s coordinate (ex. ‘A5’)
- data_type = 'n'
 
- hyperlink = None
 
- row
 
- value = None