Cell¶
- class Cell¶
A
strsubclass — the cell’s current value is the string itself.Obtain a
Cellfromget_cell()or by indexing aRow.cell = await tab.get_cell("B2") # or cell = row[1] print(cell) # "hello" (Cell is a str) print(cell.label) # "B" print(cell.row_index) # 2 print(cell.cell_index) # 1 (0-based) print(repr(cell)) # <Cell B2='hello'>
Attributes¶
Attribute |
Type |
Description |
|---|---|---|
|
|
Column label, e.g. |
|
|
1-based row number. |
|
|
0-based column index within its parent row. |
|
|
The |
|
|
Parent |
Methods¶
- async Cell.update(value, input_format='raw', render_format='formatted') Cell¶
Writes a new value and returns an updated
Cellinstance.- Parameters:
- Returns:
A new
Cellwith the updated value.- Return type:
Warning
Cellis immutable (it is astr).update()returns a newCell— reassign the variable to keep the updated value.cell = await cell.update("new value") cell = await cell.update("=SUM(A1:A10)", input_format="user_entered")
- async Cell.clear()¶
Clears the cell’s value.
await cell.clear()
- async Cell.style(obj)¶
Applies formatting to this cell.
- Parameters:
obj – A
Styleinstance or a rawgspread_formatting.CellFormat.
await cell.style(Style(bold=True, text_color="#cc0000"))