Sheets

class Sheets(impl)

A collection of all sheet objects:

>>> import xlwings as xw
>>> xw.sheets  # active book
Sheets([<Sheet [Book1]Sheet1>, <Sheet [Book1]Sheet2>])
>>> xw.Book('Book1').sheets  # specific book
Sheets([<Sheet [Book1]Sheet1>, <Sheet [Book1]Sheet2>])

在 0.9.0 版本加入.

property active: Sheet

返回活动的工作表(Sheet)。

add(name=None, before=None, after=None)

创建一个新的工作表并设为活动工作表。

参数:
  • name (str | None) -- 新工作表的名字,如果没有就使用Excel给的缺省名字。

  • before (Sheet | None) -- 在新增工作表前面的工作表对象。

  • after (Sheet | None) -- 在新增工作表后面的工作表对象。

返回:

Added sheet object

返回类型:

Sheet

async get_active()

Returns the active Sheet, fetched live from Excel.

Requires xlwings Lite.

在 0.35.0 版本加入.