load_workbook() - Error: list index out of range
Created originally on Bitbucket by Anonymous
I don't know what happened.. but I'm not able to read .xlsx files with openpyxl anymore
#!python
from openpyxl import Workbook, load_workbook
from glob import glob
filename = glob('*.xlsx')[0]
print filename
wb = load_workbook(filename)
ws = wb.active()
print ws.cell('A12').value # D18
Gives me the following output / error
#!python
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-2-d47bd728303c> in <module>()
6 print filename
7
----> 8 wb = load_workbook(filename)
9
10 ws = wb.active()
C:\Python27\lib\site-packages\openpyxl\reader\excel.pyc in load_workbook(filename, use_iterators, keep_vba, guess_types, data_only)
134
135 try:
--> 136 _load_workbook(wb, archive, filename, use_iterators, keep_vba)
137 except KeyError:
138 e = exc_info()[1]
C:\Python27\lib\site-packages\openpyxl\reader\excel.pyc in _load_workbook(wb, archive, filename, use_iterators, keep_vba)
172 assert wb.loaded_theme == None, "even though the theme information is missing there is a theme object ?"
173
--> 174 style_properties = read_style_table(archive.read(ARC_STYLE))
175 style_table = style_properties.pop('table')
176 wb.style_properties = style_properties
C:\Python27\lib\site-packages\openpyxl\reader\style.pyc in read_style_table(xml_source)
81
82 if cell_xfs_node.get('applyFill') == '1':
---> 83 new_style.fill = deepcopy(fill_list[int(cell_xfs_node.get('fillId'))])
84 new_style.fill.start_color = deepcopy(fill_list[int(cell_xfs_node.get('fillId'))].start_color)
85 new_style.fill.end_color = deepcopy(fill_list[int(cell_xfs_node.get('fillId'))].end_color)
IndexError: list index out of range
Project Calendar.xlsx
Name: openpyxl Version: 1.8.4 PyPi Version: 1.8.4 Location: c:\python27\lib\site-packages home_page: http://openpyxl.readthedocs.org Summary: A Python library to read/write Excel 2007 xlsx/xlsm files Requires: Required by(1): pandas[io]
import openpyxl openpyxl.LXML_VERSION (3, 3, 1, 0)
Attachments: Project_Calendar.xlsx