Writing to existing workbook

ぐ巨炮叔叔 提交于 2019-12-11 08:58:11

问题


I was wondering if someone could help me out with this. I want to make changes to an existing .xls file using xlwt/xlrd/xlutils. I took a look at this question and tried the two answers at the bottom of the page. When I tried the second answer, I got this error:

AttributeError: 'Sheet' object has no attribute 'cooked_page_break_preview_mag_factor'

When I tried the third answer, I got this error:

AttributeError: 'str' object has no attribute 'datemode'

The files I'm using are exactly the same as the ones in the answers with the exception of the filenames.

I appreciate any help. I would have commented on the answers but I don't have enough rep.


回答1:


I had the same error and realised that I was copying the sheet instead of the workbook.

rb = open_workbook(file_path,formatting_info=True)
wb = copy(rb)


来源:https://stackoverflow.com/questions/14554770/writing-to-existing-workbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!