写入现有工作簿 [英] Writing to existing workbook

查看:171
本文介绍了写入现有工作簿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以帮助我解决这个问题.我想使用xlwt/xlrd/xlutils对现有的.xls文件进行更改.我查看了这个问题,并尝试了以下问题的两个答案这一页.当我尝试第二个答案时,出现此错误:

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.

推荐答案

我遇到了相同的错误,并意识到我正在复制工作表而不是工作簿.

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)

这篇关于写入现有工作簿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆