python修改 excel文件
fromxlrdimportopen_workbookfromxlwtimporteasyxffromxlutils.copyimportcopymystyle=easy...
from xlrd import open_workbook
from xlwt import easyxf
from xlutils.copy import copy
mystyle = easyxf('font:color red;')
rb = open_workbook('aa.xls',formatting_info=True)
wb = copy(rb)
wb.get_sheet(0).write(2,4,'some value',mystyle)
wb.save('aa.xls')
运行之后出问题:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
wb=copy(rb)
File "C:\Python25\Lib\site-packages\xlutils\copy.py", line 13, in copy
w
File "C:\Python25\Lib\site-packages\xlutils\filter.py", line 812, in process
reader(chain[0])
File "C:\Python25\Lib\site-packages\xlutils\filter.py", line 67, in __call__
if workbook.on_demand:
AttributeError: 'Book' object has no attribute 'on_demand' 展开
from xlwt import easyxf
from xlutils.copy import copy
mystyle = easyxf('font:color red;')
rb = open_workbook('aa.xls',formatting_info=True)
wb = copy(rb)
wb.get_sheet(0).write(2,4,'some value',mystyle)
wb.save('aa.xls')
运行之后出问题:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
wb=copy(rb)
File "C:\Python25\Lib\site-packages\xlutils\copy.py", line 13, in copy
w
File "C:\Python25\Lib\site-packages\xlutils\filter.py", line 812, in process
reader(chain[0])
File "C:\Python25\Lib\site-packages\xlutils\filter.py", line 67, in __call__
if workbook.on_demand:
AttributeError: 'Book' object has no attribute 'on_demand' 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询