Tab¶
- class Tab¶
Extends gspread’s
Worksheetwith async helpers.Obtain a
Tabviaget_tab()ortabs().
Reading¶
- async Tab.values(**kwargs) list[Row]¶
Returns every row in the sheet as a list of
Rowobjects.rows = await tab.values() for row in rows: print(row)
- async Tab.get_row(serial_no) Row¶
Returns the row at the given 1-based index.
first_row = await tab.get_row(1)
- async Tab.get_cell(cell_name, render_option='formatted') Cell¶
Fetches a single cell by its A1 address. Both single-letter (
B3) and multi-letter (AA10) column labels are supported.- Parameters:
- Returns:
The requested cell.
- Return type:
cell = await tab.get_cell("B2") formula = await tab.get_cell("C1", render_option="formula")
Writing¶
- async Tab.append(data, get_row=False) Row | None¶
Appends a new row at the bottom of the sheet.
- Parameters:
- Returns:
The appended row when
get_row=True, otherwiseNone.- Return type:
Row | None
await tab.append(["Alice", "30", "Engineer"]) # Get the appended row back row = await tab.append(["Bob", "25"], get_row=True)
- async Tab.del_row(start, end=None)¶
Deletes one or more rows by their 1-based indices.
- Parameters:
await tab.del_row(3) # delete row 3 await tab.del_row(3, end=5) # delete rows 3, 4, and 5
- async Tab.del_cell(start, end=None, shift='up')¶
Deletes a cell or a rectangular range, shifting the remaining cells.
- Parameters:
await tab.del_cell("B2") # single cell, shift up await tab.del_cell("B2", shift="left") # single cell, shift left await tab.del_cell("A1", "C3") # delete a 3×3 range