macpie.MACPieExcelWriter#
- class macpie.MACPieExcelWriter(*args, **kwargs)#
Class for writing Dataset objects into Excel sheets.
Default is to use the
mp_xlsxwriterengine, which is the macpie version of panda’sxlsxwriterengine. It has the best writing performance. The other engine option ismp_openpyxl(the macpie version of theopenpyxlengine).mp_xlsxwriterengine-specific options:autofit_columns- True/False. Whether to autofit columns.strip_carriage_returns- True/False. Whether to strip carriage returns (i.e. “\r”). Otherwise Excel will encode it as “_x000D_”. See jmcnamara/XlsxWriter#680.
Notes
This is the analog of
pandas.ExcelWriter, so read the documentation for that class for descriptions of available parameters, notes, and examples.Examples
writer = mp.MACPieExcelWriter( file_path, engine="mp_xlsxwriter", engine_kwargs={ "options": {"autofit_columns": True, "strip_carriage_returns": True} }, )
- __init__(path: FilePath | WriteExcelBuffer | ExcelWriter, engine: str | None = None, date_format: str | None = None, datetime_format: str | None = None, mode: str = 'w', storage_options: StorageOptions = None, if_sheet_exists: str | None = None, engine_kwargs: dict[str, Any] | None = None, **kwargs) None#
Methods
__init__(path[, engine, date_format, ...])check_extension(ext)checks that path's extension against the Writer's supported extensions.
close()synonym for save, to make it more file-like
finalize_sheet_order()finalized_sheet_order(sheetnames)highlight_duplicates(sheet_name, column_name)save()Save workbook to disk.
sheet_names()write_cells(cells[, sheet_name, startrow, ...])Write given formatted cells into Excel an excel sheet
write_excel_dict(excel_dict)write_tablib_dataset(tlset[, freeze_panes])Attributes
bookBook instance.
cur_sheetCurrent sheet for writing.
date_formatFormat string for dates written into Excel files (e.g.
datetime_formatFormat string for dates written into Excel files (e.g.
engineName of engine.
handlesHandles to Excel sheets.
if_sheet_existsHow to behave when writing to a sheet that already exists in append mode.
pathPath to Excel file.
sheetsMapping of sheet names to sheet objects.
supported_extensionsExtensions that writer engine supports.