Cell

class exceltablekit.table.cell.Cell(column, row)[source]

Represents a single Excel cell identified by a column letter string and a 1-based integer row number.

Cell instances are created automatically by Table. You rarely need to instantiate them directly unless you are extending the library.

Parameters:
  • column (str) – Excel column letter(s), case-insensitive (e.g. "A", "AB", "XFD"). Must not exceed column 16 384.

  • row (int) – 1-based row number. Must be between 1 and 1 048 576 inclusive.

Raises:

Example:

from exceltablekit import Cell

cell = Cell("B", 5)
print(cell.get_cell())    # "B5"
print(cell.get_column())  # "B"
print(cell.get_row())     # 5

Methods

get_cell()[source]

Return the cell address in "A1" notation.

Returns:

Cell address string (e.g. "B5").

Return type:

str

get_column()[source]

Return the column letter(s).

Returns:

Column string, always uppercase (e.g. "B").

Return type:

str

get_row()[source]

Return the row number.

Returns:

1-based row integer.

Return type:

int

set_property(worksheet, property, value)[source]

Set a style attribute on the underlying openpyxl cell object.

Parameters:
  • worksheet (openpyxl.worksheet.worksheet.Worksheet) – The openpyxl Worksheet that contains this cell.

  • property (str) – The cell attribute to set (e.g. "fill", "font", "alignment", "border").

  • value – The value to assign — typically an openpyxl style object.

Example:

from openpyxl import Workbook
from openpyxl.styles import PatternFill
from exceltablekit import Cell

wb = Workbook()
ws = wb.active

cell = Cell("C", 3)
fill = PatternFill(fill_type="solid", fgColor="FFFF00")
cell.set_property(ws, "fill", fill)

wb.save("output.xlsx")