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)[源代码]¶
基类:
object
Read an Excel package and dispatch the contents to the relevant modules
- openpyxl.reader.excel.load_workbook(filename, read_only=False, keep_vba=False, data_only=False, keep_links=True)[源代码]¶
Open the given filename and return the workbook
- 参数
filename (string or a file-like object open in binary mode c.f.,
zipfile.ZipFile
) – the path to open or a file-like objectread_only (bool) – optimised for reading, content cannot be edited
keep_vba (bool) – preseve vba content (this does NOT mean you can use it)
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
- 返回类型
openpyxl.workbook.Workbook
备注
When using lazy load, all worksheets will be
openpyxl.worksheet.iter_worksheet.IterableWorksheet
and the returned workbook will be read-only.