Excel .xlsx (openpyxl)

petlx.xlsx.fromxlsx(filename, sheet=None, range=None, **kwargs)[source]

Extract a table from a sheet in an Excel (.xlsx) file.

N.B., the sheet name is case sensitive, so watch out for, e.g., ‘Sheet1’.

The package openpyxl is required. Instructions for installation can be found at https://bitbucket.org/ericgazoni/openpyxl/wiki/Home or try pip install openpyxl.

Changed in version 0.15.

The sheet argument can be omitted, in which case the first sheet in the workbook is used by default.

The range argument can be used to provide a range string specifying a range of cells to extract.

Any other keyword arguments are passed through to openpyxl.load_workbook().

petlx.xlsx.toxlsx(tbl, filename, sheet=None, encoding='utf-8')[source]

Write a table to a new Excel (.xlsx) file.

New in version 0.15.