Possibly incorrect reading of an XLSX file
Created originally on Bitbucket by kurakin_alexander (Alexander Kurakin)
Hello!
There is an issue. There are some facts about it:
-
I have an XLSX file.
-
It’s private (from my job). It’s difficult to post it anywhere.
-
docProps/app.xml
says thatApplication
isMicrosoft Excel
andAppVersion
is14.0300
. -
But strictly saying, I don’t know how it has been created.
-
I’m trying to read it with Pandas 1.0.3’s read_excel method.
-
If I use xlrd as an
engine
, no errors occurred. -
If I use openpyxl as an
engine
, I get:Traceback (most recent call last):
File "test.py", line 6, in <module>
pd.read_excel(sys.argv[1], index_col=[0,1,2], engine=engine)
File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 334, in read_excel
**kwds,
File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 888, in parse
**kwds,
File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 480, in parse
last = data[offset][col]
IndexError: list index out of range
Code is:
import pandas as pd pd.read_excel('test.xlsx', index_col=[0,1,2], engine='openpyxl')
-
I have debugged the code. There is a row on which xlrd returns four cells/values:
['Text', '', '', '']
. -
But openpyxl returns one cell/value:
['Text']
as these values are:(1, 1, None, None)
. -
If I just save a file with LibreOffice Calc (without any modifications), there is no exceptions.
-
If I just save a file with LibreOffice Calc (without any modifications), openpyxl returns (pp.8-9) four cells/values:
['Text', '', '', '']
, on that row, as these values are:(1, 1, 4, 98)
.
Questions:
- Isn’t it a known issue? Application-creator bug or incompatibility, maybe?
- Is there any interest about this issue? I could try to debug more.
openpyxl 3.0.3
Thanks!