I want to export a pandas dataframe to an existing workbook but it is actually overwritting the existing sheet. I want the dataframe to be exported to a new sheet keeping all other existing sheets in the workbook intact.
Below is the code I tried:
path = r'C:\...\myworkbook.xlsx'
with pd.ExcelWriter(path, mode = 'a', engine = 'openpyxl', date_format = "YYYY-MM-DD") as writer:
df.to_excel(writer, sheet_name = "new', index = False)
Also the date formatting is not working. Any help would be much appreciated, thanks!