The Workbook Object

class Workbook(encoding='ascii', style_compression=0)

This is a class representing a workbook and all its contents. When creating Excel files with xlwt, you will normally start by instantiating an object of this class.

Parameters:
  • encoding (str) – standard python encoding identifier
  • style_compression (int) –

    ???

Workbook.add_sheet(sheetname)

This method is used to create Worksheets in a Workbook.

Parameters:
  • sheetname (str) – The name to use for this sheet, as it will appear in the tabs at the bottom of the Excel application.
Returns:

Worksheet object

Workbook.save(filename)

This method is used to save Workbook to a file in native Excel format.

Parameters:
  • filename

    This can be a string containing a filename of the file, in which case the excel file is saved to disk using the name provided.

    It can also be a stream object with a write method, such as a StringIO, in which case the data for the excel file is written to the stream.

Previous topic

Package Contents

Next topic

The Worksheet Class

This Page