2

我需要将 DataFrame 放到现有 XLS 文件中的现有工作表中。我正在寻找问题的解决方案:
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()

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.

我需要保持 xls 格式,如 xlwt
所以用代码:

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()

我明白了

ValueError: Append mode is not supported with xlwt!

有没有办法将数据框附加/放入现有的 XLS 文件?

4

0 回答 0