@@ -1916,32 +1916,24 @@ def _repr_latex_(self):
1916
1916
... index=['row 1', 'row 2'],
1917
1917
... columns=['col 1', 'col 2'])
1918
1918
>>> df1.to_excel("output.xlsx")
1919
+
1920
+ If you want to set engine that can manipulate Excel,
1921
+ pass keyword argument named engine. Actually
1922
+ engine is automatically chosen by file extension:
1923
+
1924
+ >>> df1.to_excel('output1.xlsx', engine='xlsxwriter')
1919
1925
1920
1926
To specify the sheet name:
1921
1927
1922
1928
>>> df1.to_excel("output.xlsx", sheet_name='Sheet_name_1')
1923
-
1929
+
1924
1930
If you wish to write to more than one sheet in the workbook, it is
1925
1931
necessary to specify an ExcelWriter object:
1926
1932
1927
- >>> with ExcelWriter('output.xlsx') as writer:
1933
+ >>> with pd. ExcelWriter('output.xlsx') as writer:
1928
1934
... df1.to_excel(writer, sheet_name='Sheet_name_1')
1929
1935
... df2.to_excel(writer, sheet_name='Sheet_name_2')
1930
1936
1931
- If you want to set engine that can manipulate Excel,
1932
- pass keyword argument named engine. Actually
1933
- engine is automatically chosen by file extension:
1934
-
1935
- >>> df1.to_excel('output1.xlsx', engine='xlsxwriter')
1936
- >>> with ExcelWriter('output2.xlsx', engine='openpyxl') as writer:
1937
- ... df2.to_excel(writer)
1938
-
1939
- You can set date format or datetime format:
1940
-
1941
- >>> with ExcelWriter('path_to_file.xlsx',
1942
- date_format='YYYY-MM-DD',
1943
- datetime_format='YYYY-MM-DD HH:MM:SS') as writer:
1944
- ... df.to_excel(writer)
1945
1937
1946
1938
"""
1947
1939
0 commit comments