rattail.excel
¶
Excel utilities
- rattail.excel.ExcelReader¶
alias of
ExcelReaderXLS
- class rattail.excel.ExcelReaderXLS(path, sheet=0, sheet_name=None, header=0, first_data_row=None, datefmt='%Y-%m-%d', strip_fieldnames=True)[source]¶
Basic class for reading Excel “legacy” (.xls) files.
Uses the
xlrd
package to read the files.
- class rattail.excel.ExcelReaderXLSX(path, header_row=1, strip_fieldnames=True, datefmt='%Y-%m-%d', **kwargs)[source]¶
Basic class for reading Excel 2010 (.xslx) files.
Uses the openpyxl package to read the files.
- Parameters:
path¶ – Path to the Excel data file.
header_row¶ – 1-based row number which contains the header, with field names.
strip_fieldnames¶ – If true (the default), any whitespace surrounding the field names will be stripped, i.e. after they are read from the header row. Pass
False
here to suppress the behavior and leave whitespace intact.
- class rattail.excel.ExcelWriter(path, fields, sheet_title=None, number_formats={}, highlight_rows=True)[source]¶
Base class for Excel writers.
- save(progress=None)[source]¶
Save the Excel workbook to file. If
progress
is provided, it will be used in a hacky sort of way, i.e. from 0 to 1 only since we have no way of knowing true progress for the save operation. (But it can still be nice to let user know this is the step we’re on at least.)