GPWorkbook

Bases: Workbook

Wrapper for an XlsxWriter.Workbook object.

add_worksheet(name: str = None, gridlines: str = 'hide_all') -> GPWorksheet

Overwrite add_worksheet() to create a GPWorksheet object.

Parameters:

Name Type Description Default
name str(optional)

name of the the worksheet to be created

None
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'

Returns:

Name Type Description
worksheet GPWorksheet

a worksheet object, which supports writing of GPTable objects

make_notesheet(notes_table: pd.DataFrame, table_name: str = None, title: str = None, instructions: str = None) -> GPTable

Generate notes table sheets from notes table and optional customisation parameters.

Parameters:

Name Type Description Default
notes_table DataFrame

table with notes reference, text and (optional) link columns

required
table_name str

notes table name, defaults to "notes_table"

None
title str

notes page title, defaults to "Notes"

None
instructions str

description of the page layout defaults to "This worksheet contains one table."

None

Returns:

Type Description
GPTable
make_table_of_contents(sheets: dict, additional_elements: list = None, column_names: list = None, table_name: str = None, title: str = None, subtitles: list = None, instructions: str = None) -> GPTable

Generate table of contents from sheet and optional customisation parameters.

Parameters:

Name Type Description Default
sheets dict

mapping worksheet labels to gptables.GPTable objects

required
additional_elements List[str]

additional GPTable elements to display in the contents table. Allowed elements are "subtitles", "scope", "source" and "instructions".

None
column_names List[str]

table of contents column names, defaults to "Sheet name", "Table description"

None
table_name str

contents table name, defaults to "contents_table"

None
title str

table of contents title, defaults to "Table of contents"

None
subtitles list

list of subtitles as strings

None
instructions str

description of the page layout defaults to "This worksheet contains one table."

None

Returns:

Type Description
GPTable
set_theme(theme: Theme) -> None

Sets the theme for all GPTable objects written to the Workbook.

Parameters:

Name Type Description Default
theme Theme

a Theme object containing the formatting to be applied to GPTable objects written to Worksheets within this Workbook

required

Returns:

Type Description
None