TableRows
The collection belongs to a Table. Use TableRow to delete an indexed row.
- class TableRows
Collection of data rows in a table. Row indexes are one-based; square-bracket lookup is zero-based. In xlwings Lite,
len(rows)uses loaded metadata; useawait rows.get_count()for the current count.示例
import xlwings as xw rows = xw.Book().sheets[0].tables["Table1"].rows rows.add(["Pencil", 2]) # Append rows.add(["Pen", 3], index=1) # Insert before the first data row print(rows[0].range.value) # ["Pen", 3]