Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexerror when loading Excel sheet #42

Open
ArneBachmann opened this issue Jun 17, 2020 · 1 comment
Open

Indexerror when loading Excel sheet #42

ArneBachmann opened this issue Jun 17, 2020 · 1 comment

Comments

@ArneBachmann
Copy link

I process cost reports every month, but something seems to have changed in the generated Excel sheets, hence:

Traceback (most recent call last):
  File "check-duplicates.py", line 13, in <module>
    sheets = get_data(sys.argv[1])
  File "C:\ProgramData\Miniconda3\lib\site-packages\pyexcel_xlsx\__init__.py", line 41, in get_data
    return read_data(afile, file_type=file_type, **keywords)
  File "C:\ProgramData\Miniconda3\lib\site-packages\pyexcel_io\io.py", line 73, in get_data
    afile, file_type=file_type, streaming=False, **keywords
  File "C:\ProgramData\Miniconda3\lib\site-packages\pyexcel_io\io.py", line 91, in _get_data
    return load_data(**keywords)
  File "C:\ProgramData\Miniconda3\lib\site-packages\pyexcel_io\io.py", line 204, in load_data
    reader.open(file_name, **keywords)
  File "C:\ProgramData\Miniconda3\lib\site-packages\pyexcel_xlsx\xlsxr.py", line 145, in open
    self._load_the_excel_file(file_name)
  File "C:\ProgramData\Miniconda3\lib\site-packages\pyexcel_xlsx\xlsxr.py", line 209, in _load_the_excel_file
    read_only=read_only_flag,
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\reader\excel.py", line 196, in load_workbook
    apply_stylesheet(archive, wb) # bind styles to workbook
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 180, in apply_stylesheet
    stylesheet = Stylesheet.from_tree(node)
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 102, in from_tree
    return super(Stylesheet, cls).from_tree(node)
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\descriptors\serialisable.py", line 100, in from_tree
    return cls(**attrib)
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 93, in __init__
    self.named_styles = self._merge_named_styles()
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 113, in _merge_named_styles
    self._expand_named_style(style)
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 123, in _expand_named_style
    xf = self.cellStyleXfs[named_style.xfId]
  File "C:\ProgramData\Miniconda3\lib\site-packages\openpyxl\styles\cell_style.py", line 186, in __getitem__
    return self.xf[idx]
IndexError: list index out of range

I don't know what could be the reason, maybe you can understand better.

@chfw
Copy link
Member

chfw commented Jun 17, 2020

thanks for reporting. for debugging, I would need your file to reproduce it.

while I will be looking at the issue, please do this if you can work around it:

$ pip uninstall pyexcel-xlsx
$ pip install pyexcel-xls # which can read xlsx file but just cannot write one for you

Last alternative is:

$ pip install pyexcel-xlsr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants