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>])

New in version 0.9.0.

property active#

Returns the active Sheet.

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

Creates a new Sheet and makes it the active sheet.

Parameters
  • name (str, default None) – Name of the new sheet. If None, will default to Excel’s default name.

  • before (Sheet, default None) – An object that specifies the sheet before which the new sheet is added.

  • after (Sheet, default None) – An object that specifies the sheet after which the new sheet is added.

Returns

sheet – Added sheet object

Return type

Sheet