Class CellObj

class ooodev.utils.data_type.cell_obj.CellObj(col, row, sheet_idx=-1, range_obj=None)[source]

Cell Parts

See also

Changed in version 0.32.0: If index is set to -2 then no attempt is made to get index from spreadsheet.

New in version 0.8.2.

Parameters:
  • col (str) –

  • row (int) –

  • sheet_idx (int) –

  • range_obj (mRngObj.RangeObj | None) –

__init__(col, row, sheet_idx=-1, range_obj=None)
Parameters:
  • col (str) –

  • row (int) –

  • sheet_idx (int) –

  • range_obj (mRngObj.RangeObj | None) –

Return type:

None

static from_cell(cell_val: str) ooodev.utils.data_type.cell_obj.CellObj[source]
static from_cell(cell_val: ooodev.utils.data_type.cell_obj.CellObj) ooodev.utils.data_type.cell_obj.CellObj
static from_cell(cell_val: ooo.lo.table.cell_address.CellAddress) ooodev.utils.data_type.cell_obj.CellObj
static from_cell(cell_val: ooodev.utils.data_type.cell_values.CellValues) ooodev.utils.data_type.cell_obj.CellObj
static from_cell(cell_val)

Gets a CellObj instance from a string

Parameters:

cell_val (str | CellAddress | CellValues | CellObj) – Cell value. If cell_val is CellObj` then that instance is returned.

Returns:

Cell Object

Return type:

CellObj

Note

If a range name such as A23:G45 or Sheet1.A23:G45 then only the first cell is used.

static from_idx(col_idx, row_idx, sheet_idx=-1)[source]

Gets a CellObj from zero-based col and row indexes

Parameters:
  • col_idx (int) – Column index

  • row_idx (int) – Row index

  • sheet_idx (int, optional) – Sheet index

Returns:

Cell object

Return type:

CellObj

get_cell_address()[source]

Gets a cell address

Returns:

Cell Address

Return type:

CellAddress

get_cell_values()[source]

Gets cell values

Returns:

Cell Values instance.

Return type:

CellValues

get_range_obj()[source]

Gets a Range object that has start and end column set to this instance cell values.

Returns:

Range Object

Return type:

RangeObj

set_sheet_index(idx=None)[source]

Set the sheet index for the cell.

If idx is None then the active sheet index is used.

Parameters:

idx (int, optional) – Sheet index, Default None.

Returns:

Self

Return type:

RangeObj

New in version 0.32.0.

col: str

Column such as A

property col_obj: ColObj

Gets Column object

Return type:

ColObj

property down: CellObj

Gets the cell below of current cell

Return type:

CellObj

property left: CellObj

Gets the cell to the left of current cell

Raises:

IndexError – If cell left is out of range

Return type:

CellObj

range_obj: mRngObj.RangeObj | None = None

Range Object that instance is part of

property right: CellObj

Gets the cell to the right of current cell

Return type:

CellObj

row: int

One based row such as 125

property row_obj: RowObj

Gets Row object

Return type:

RowObj

sheet_idx: int = -1

Sheet index that this cell value belongs to. If value is -1 then the active spreadsheet, if available, is used to get the sheet index. If the value is -2 then no sheet index is applied.

property up: CellObj

Gets the cell above of current cell

Raises:

IndexError – If cell above is out of range

Return type:

CellObj