-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: #40231 does not allow writing multiple dataframes to a single sheet #42221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Tagging for 1.3 pending further discussion. |
Summary: #40230 did not include the |
An open PR, #42222 is an enhancement so not milestoned 1.3x. |
@simonjayhawkins - #42222 is adding back in the feature that was (unknowingly, I think) removed. If that's regarded as an enhancement, how can this regression get fixed for e.g. 1.3.2? That said, there was opposition to implementing the option in question back in the PR causing this regression. If there is still sufficient opposition to this, then it seems to me the regression should be closed as a won't-fix. |
I have hit this regression as well in multiple workflows that I have and it is causing a lot of problems for me and my company. |
This will be solved by #42222 which will be merged soon and out in 1.4.0 :) |
Behaviour should the be: with ExcelWriter("existing_file.xlsx", engine="openpyxl", mode="a", if_sheet_exists="overlay") as writer:
df1.to_excel(writer, sheet="sheet")
df2.to_excel(writer, sheet="sheet") |
Uh oh!
There was an error while loading. Please reload this page.
The problem
The following code works well, both in 1.4.0 and 1.2.5:
however, the following code raises an error in 1.4.0, but works in 1.2.5 (it creates a new sheet and writes both dataframes to it):
Also other options cannot replicate the old behaviour.
Describe the solution you'd like
An added option to
if_sheet_exists="write_to"
that justs selects the sheet and writes into it, without first deleting its contents. This also allows to append a dataframe within a sheet.EDIT: in #40230 this was also suggested behaviour, but it was not implemented:
The text was updated successfully, but these errors were encountered: