openpyxl.reader.excel module

Read an xlsx file into Python

class openpyxl.reader.excel.ExcelReader(fn, read_only=False, keep_vba=False, data_only=False, keep_links=True)[source]

Bases: object

Read an Excel package and dispatch the contents to the relevant modules

read()[source]
read_chartsheet(sheet, rel)[source]
read_manifest()[source]
read_properties()[source]
read_strings()[source]
read_theme()[source]
read_workbook()[source]
read_worksheets()[source]
openpyxl.reader.excel.load_workbook(filename, read_only=False, keep_vba=False, data_only=False, keep_links=True)[source]

Open the given filename and return the workbook

Parameters:
  • filename (string or a file-like object open in binary mode c.f., zipfile.ZipFile) – the path to open or a file-like object
  • read_only (bool) – optimised for reading, content cannot be edited
  • keep_vba (bool) – preseve vba content (this does NOT mean you can use it)
  • guess_types (bool) – guess cell content type and do not read it from the file
  • data_only (bool) – controls whether cells with formulae have either the formula (default) or the value stored the last time Excel read the sheet
  • keep_links (bool) – whether links to external workbooks should be preserved. The default is True
Return type:

openpyxl.workbook.Workbook

Note

When using lazy load, all worksheets will be openpyxl.worksheet.iter_worksheet.IterableWorksheet and the returned workbook will be read-only.