读取xlsx文件时出错(openpyxl)

时间:2015-08-30 15:57:04

标签: python excel file python-2.7 spreadsheet

我想阅读xlsx文件,但我收到错误 我的代码:

from openpyxl import load_workbook
wb = load_workbook(filename = 'F:\123.xlsx', use_iterators=True)

错误:

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    wb = load_workbook(filename = '123.xlsx', use_iterators=True)
  File "C:\Python27\lib\site-packages\openpyxl-2.3.0b1-py2.7.egg\openpyxl\reader\excel.py", line 202, in load_workbook
    parsed_styles = read_style_table(archive)
  File "C:\Python27\lib\site-packages\openpyxl-2.3.0b1-py2.7.egg\openpyxl\reader\style.py", line 181, in read_style_table
    p.parse()
  File "C:\Python27\lib\site-packages\openpyxl-2.3.0b1-py2.7.egg\openpyxl\reader\style.py", line 53, in parse
    self.parse_named_styles()
  File "C:\Python27\lib\site-packages\openpyxl-2.3.0b1-py2.7.egg\openpyxl\reader\style.py", line 109, in parse_named_styles
    names = self._parse_style_names()
  File "C:\Python27\lib\site-packages\openpyxl-2.3.0b1-py2.7.egg\openpyxl\reader\style.py", line 128, in _parse_style_names
    for _name in node:
TypeError: 'NoneType' object is not iterable

怎么可以瘦? 感谢

1 个答案:

答案 0 :(得分:0)

这是openpyxml库中的一个错误,幸运的是它已修复,您的问题可以通过升级到2.3.1或更高版本来解决。请参阅我的回答:https://stackoverflow.com/a/35669067/170918