produce_workbook()

Produces a formatted workbook.

Can be written to an .xlsx file as specified in filename using .close().

Parameters:

Name Type Description Default
filename str

path to write final workbook to (an .xlsx file)

required
sheets dict

mapping worksheet labels to GPTable objects

required
theme Theme

formatting to be applied to GPTable elements. gptheme is used by default.

None
cover Cover

cover page text. Including this argument will generate a cover page.

None
contentsheet_label str

table of contents sheet label, defaults to "Contents". If None, table of contents will not be generated.

'Contents'
contentsheet_options dict

dictionary of contentsheet customisation parameters. Valid keys are additional_elements, column_names, table_name, title, subtitles and instructions.

None
contentsheet_location str

Either "sheet" or "cover". Defaults to "sheet", which creates the table of contents on a separate worksheet named by contentsheet_label. Set to "cover" to append the table of contents to the cover worksheet; this requires cover to be provided. Any other value raises ValueError.

'sheet'
notes_table DataFrame

table with notes reference, text and (optional) link columns. If None, notes sheet will not be generated.

None
notesheet_label str

notes sheet label, defaults to "Notes"

'Notes'
notesheet_options dict

dictionary of notesheet customisation parameters. Valid keys are table_name, title and instructions.

None
auto_width bool or dict

If bool, applies to all sheets. If dict, should map sheet labels to bools.

True
gridlines string

option to hide or show gridlines on worksheets. "show_all" - don't hide gridlines, "hide_printed" - hide printed gridlines only, or "hide_all" - hide screen and printed gridlines.

'hide_all'
cover_gridlines bool

indication if gridlines should apply to the cover worksheet. False by default.

False
workbook_options dict

options to pass to the underlying xlsxwriter.Workbook constructor. See the xlsxwriter docs <https://xlsxwriter.readthedocs.io/workbook.html>_ for available options (e.g. {'strings_to_numbers': True}).

None

Returns:

Name Type Description
workbook GPWorkbook