Skip to content

Commit f872bcd

Browse files
sameshldatapythonista
authored andcommitted
DOC: Add append example in to_excel documentation (#27852)
1 parent 2349783 commit f872bcd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/generic.py

+6
Original file line numberDiff line numberDiff line change
@@ -2179,6 +2179,12 @@ def _repr_data_resource_(self):
21792179
... df1.to_excel(writer, sheet_name='Sheet_name_1')
21802180
... df2.to_excel(writer, sheet_name='Sheet_name_2')
21812181
2182+
ExcelWriter can also be used to append to an existing Excel file:
2183+
2184+
>>> with pd.ExcelWriter('output.xlsx',
2185+
... mode='a') as writer: # doctest: +SKIP
2186+
... df.to_excel(writer, sheet_name='Sheet_name_3')
2187+
21822188
To set the library that is used to write the Excel file,
21832189
you can pass the `engine` keyword (the default engine is
21842190
automatically chosen depending on the file extension):

0 commit comments

Comments
 (0)