Skip to content

Excel Export Specific options

Bases: ExportOptions


              flowchart TD
              metaframe.src.utils.opts_dataclass.export_excel.ExportOptionsExcel[ExportOptionsExcel]
              metaframe.src.utils.opts_dataclass.export.ExportOptions[ExportOptions]

                              metaframe.src.utils.opts_dataclass.export.ExportOptions --> metaframe.src.utils.opts_dataclass.export_excel.ExportOptionsExcel
                


              click metaframe.src.utils.opts_dataclass.export_excel.ExportOptionsExcel href "" "metaframe.src.utils.opts_dataclass.export_excel.ExportOptionsExcel"
              click metaframe.src.utils.opts_dataclass.export.ExportOptions href "" "metaframe.src.utils.opts_dataclass.export.ExportOptions"
            

Excel-specific export options.

Extends ExportOptions with parameters controlling how the DataFrame is written to Excel files.

Parameters:

Name Type Description Default
merge_cells bool

Whether MultiIndex headers should be merged into spanning cells. The resulting Excel file could be impossible to restore by reading, and autofilters could be disfonctional as merged cells insert NAs in some Excel versions. Safe in Google Sheets.

False
merge_cells_summary bool

Whether to merge cells in summary sheets.

False
sheet_name str | None

Name of the main worksheet. Can be set to None to deactivate the writing of the main sheet.

"DataFrame"
sheet_name_mfr str

Name of the worksheet containing the MetaFrameRow. Used only if extensive=True.

"MFR"
sheet_name_mfc str

Name of the worksheet containing the MetaFrameCol. Used only if extensive=True.

"MFC"
sheet_name_summary_

Name of the optional summary worksheets. Can be set to None to deactivate the writing of an individual summary sheet.

required
freeze_panes bool

Whether to freeze header rows/columns for easier navigation.

False
write_dtypes bool

Whether to write the DataFrame dtypes (faster reading).

True
write_summaries bool

Whether to write summary informations

False
grp_row str | List[str] | List[List[str]] | None

Groups to apply to all grp_row*by.

None
grp_col str | List[str] | List[List[str]] | None

Groups to apply to all grp_col*by.

None
grp_

Groups definition for summaries (by parameter of groupby()). Can be set to None to deactivate the corresponding group summary.

required
summary_row_id str | List[str] | None

MetaFrameRow column(s) to keep in summaries. Can be set to None to keep all columns.

None
summary_col_id str | List[str] | None

MetaFrameCol column(s) to keep in summaries. Can be set to None to keep all columns.

None
_

Internel parameters for custom aesthetics.

required
kwargs_summary Dict

Kwargs passed to to_summary() when generating summary informations.

dict()
Source code in metaframe/src/utils/opts_dataclass/export_excel.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@dataclass
class ExportOptionsExcel(ExportOptions):
    """
    Excel-specific export options.

    Extends `ExportOptions` with parameters controlling how the
    DataFrame is written to Excel files.

    Parameters
    ----------
    merge_cells : bool, default False
        Whether MultiIndex headers should be merged into spanning cells.
        The resulting Excel file could be impossible to restore by reading,
        and autofilters could be disfonctional as merged cells insert NAs
        in some Excel versions.
        Safe in Google Sheets.
    merge_cells_summary : bool, default False
        Whether to merge cells in summary sheets.
    sheet_name : str | None, default "DataFrame"
        Name of the main worksheet.
        Can be set to None to deactivate the writing of the main sheet.
    sheet_name_mfr : str, default "MFR"
        Name of the worksheet containing the MetaFrameRow.
        Used only if `extensive=True`.
    sheet_name_mfc : str, default "MFC"
        Name of the worksheet containing the MetaFrameCol.
        Used only if `extensive=True`.
    sheet_name_summary_* : str
        Name of the optional summary worksheets.
        Can be set to None to deactivate the writing of an individual 
        summary sheet.
    freeze_panes : bool, default False
        Whether to freeze header rows/columns for easier navigation.
    write_dtypes: bool = True
        Whether to write the DataFrame dtypes (faster reading).
    write_summaries: bool = False
        Whether to write summary informations
    grp_row: str | List[str] | List[List[str]] | None = None
        Groups to apply to all grp_row*by.
    grp_col: str | List[str] | List[List[str]] | None = None
        Groups to apply to all grp_col*by.
    grp_*_by: str | List[str] | List[List[str]] | None = None
        Groups definition for summaries (`by` parameter of `groupby()`).
        Can be set to None to deactivate the corresponding group summary.
    summary_row_id: str | List[str] | None = None
        MetaFrameRow column(s) to keep in summaries.
        Can be set to None to keep all columns.
    summary_col_id: str | List[str] | None = None
        MetaFrameCol column(s) to keep in summaries.
        Can be set to None to keep all columns.
    _*:
        Internel parameters for custom aesthetics.
    kwargs_summary: Dict = field(default_factory=dict)
        Kwargs passed to `to_summary()` when generating summary informations.
    """
    merge_cells: bool = False
    merge_cells_summary: bool = False
    sheet_name: str | None = 'DataFrame'
    sheet_name_mfr: str = 'MFR'
    sheet_name_mfc: str = 'MFC'
    sheet_name_summary_basic: str | None = "Summary Basic"
    sheet_name_summary_whole: str | None = "Summary"
    sheet_name_summary_row: str | None = "Summary per Row"
    sheet_name_summary_col: str | None = "Summary per Col"
    sheet_name_summary_grp_row_whole: str | None = "Summary Grp Row "
    sheet_name_summary_grp_col_whole: str | None = "Summary Grp Col "
    sheet_name_summary_grp_row: str | None = "Summary per Grp Row "
    sheet_name_summary_grp_col: str | None = "Summary per Grp Col "
    freeze_panes: bool = False
    write_dtypes: bool = True
    write_summaries: bool = False
    grp_row: str | List[str] | List[List[str]] | None = None
    grp_col: str | List[str] | List[List[str]] | None = None
    grp_row_whole_by: str | List[str] | List[List[str]] | None = None
    grp_col_whole_by: str | List[str] | List[List[str]] | None = None
    grp_row_by: str | List[str] | List[List[str]] | None = None
    grp_col_by: str | List[str] | List[List[str]] | None = None
    summary_row_id: str | List[str] | None = None
    summary_col_id: str | List[str] | None = None
    _mfr: bool | None = None
    _no_col: bool = False
    _no_col_mfr: bool = False
    _no_col_mfc: bool = False
    _invert_col: bool = False
    _d_format: Dict | None = None
    kwargs_summary: Dict = field(default_factory=dict)