pandas 0.8.0 documentation

pandas.DataFrame.to_excel

DataFrame.to_excel(excel_writer, sheet_name='sheet1', na_rep='', cols=None, header=True, index=True, index_label=None)

Write DataFrame to a excel sheet

Parameters :

excel_writer : string or ExcelWriter object

File path or existing ExcelWriter

sheet_name : string, default ‘sheet1’

Name of sheet which will contain DataFrame

na_rep : string, default ‘’

Missing data rep’n

cols : sequence, optional

Columns to write

header : boolean or list of string, default True

Write out column names. If a list of string is given it is assumed to be aliases for the column names

index : boolean, default True

Write row names (index)

index_label : string or sequence, default None

Column label for index column(s) if desired. If None is given, and header and index are True, then the index names are used. A sequence should be given if the DataFrame uses MultiIndex.

Notes

If passing an existing ExcelWriter object, then the sheet will be added to the existing workbook. This can be used to save different DataFrames to one workbook >>> writer = ExcelWriter(‘output.xlsx’) >>> df1.to_excel(writer,’sheet1’) >>> df2.to_excel(writer,’sheet2’) >>> writer.save()