gsolve.core.excel_io.write_excel_worksheet#
- gsolve.core.excel_io.write_excel_worksheet(df, excel_file, sheet_name, if_workbook_exists='error', if_sheet_exists='error', **kwargs)[source]#
Write DataFrame to excel workbook
excel_filein the worksheetsheet_name.- Parameters:
- dfDataFrame
The DataFrame to write to the excel file.
- excel_filestr or PathLike
The path to the excel file.
- sheet_namestr
The name of the worksheet to write to.
- if_workbook_exists: {“error”, “replace”, “append”}, default “error”
Behaviour if
excel_filealready exists. - “error”: raise a ValueError. - “replace”: replace the existing file. - “append”: append to the existing file.- if_sheet_exists: {“error”, “replace”, “new”}, default “error”
Behaviour if the
sheet_namealready exists inexcel_file(append mode only) - “error”: raise a ValueError. - “replace”: replace the existing worksheet. - “new”: create a new worksheet with different name- kwargs
Additional arguments passed to
pandas.DataFrame.to_excelmethod.
See also
pandas.DataFrame.to_excelThe underlying function used to write the DataFrame to the excel file.
pandas.ExcelWriter