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:
openpyxl.styles.styleable.StyleableObjectDescribes cell associated properties.
Properties of interest include style, type, value, and address.
-
base_date¶
-
col_idx¶ The numerical index of the column
-
column¶ Column number of this cell (1-based)
-
column_letter¶
-
comment¶ Returns the comment associated with this cell
Type: openpyxl.comments.Comment
-
coordinate¶ This cell’s coordinate (ex. ‘A5’)
-
data_type¶
-
encoding¶
-
hyperlink¶ Return the hyperlink target or an empty string
-
internal_value¶ Always returns the value for excel.
-
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)
-
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:
openpyxl.styles.styleable.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¶
-
coordinate¶ This cell’s coordinate (ex. ‘A5’)
-
data_type= 'n'¶
-
hyperlink= None¶
-
row¶
-
value= None¶
-