Python DataFrame append to existing sheet in XLS file (not XLSX)

366 Views Asked by At

I need to put DataFrame to an existing Sheet in an existing XLS file. I am searching for solution for problem:
with ExcelWriter(new_mis, engine='openpyxl', mode='a') as writer:
    df_fin_k.to_excel(writer, sheet_name=new_sheet, index=False, startrow=4)
    writer.save()
writer.close()

gives

openpyxl does not support the old .xls file format, please use xlrd to read this file, or
convert it to the more recent .xlsx file format.

I need to keep xls format, as xlwt
So with code:

with ExcelWriter(new_mis, mode='a') as writer:
    df_fin_k.to_excel(writer, sheet_name=new_sheet, index=False, startrow=4)
    writer.save()
writer.close()

i get

ValueError: Append mode is not supported with xlwt!

is there any way to append/put dataframe to an existing XLS file?

0

There are 0 best solutions below