save_as from xlsx to csv: error array index out of range #20
Comments
Hi, new xlsx: output csv: |
For Test2.xlsx, it seems to work with latest tool setup:
Here's what I got:
Here's my pip packages:
For Test2_edited.xlsx, it was better:
By the way, for xlsx, you need not to import pyexcel.ext.xls. |
Hi chfw, I updated all the pyexcel packages, It should be noted that using the original code and the original xlsx file,
we still get
then, excluding the import, as you indicated,
the output is,
and, despite the warning, the output is OK!. So it appears that including the import,
pyexcel.xlx lib tries to process the xlsx file and ultimately calls xlrd and that is when the error occurs. |
Aha.. python 3. I haven't get one at hand. Will try it later. Looking at the tracback, it is related xlrd. Can you try the following code instead?
because pyexcel.ext.xls can read xlsx, as well as pyexcel.ext.xlsx, which uses openpyxl. |
Yes, xlrd can't handle that file. Python3 isn't the issue. |
OK, I read the following part of your response. openpyxl is OK |
If you want to keep xls support along with xlsx, you can do this:
So the second import will overwrite the first one. I will try to address this problem in future version of pyexcel-io v0.2.0. |
As you have pointed out, no problem with openpyxl. The problem is caused by including the import of pyexcel-xls after pyexcel-xlsx. |
The real problem is that original xlsx file. xlrd handles the 2nd one without issue. |
The point is that openpyxl handles it but with a warning and xlrd can't handle it at all. The spreadsheet is at fault. I wouldn't change pyexcel for this one off occurance. |
Can we conclude that the issue is with xlrd? Hence, probably we shall contact xlrd via this issue tacker |
Agreed. |
Thank you everyone for looking into it! My full script has to be able to handle both xls and xlsx files from clients which is why they were both in there. I appreciate the fix, switching the order of the imports was successful! |
Issue was analyzed, root cause found and error was filed. Hence closing this issue. Please follow xlrd issue #167 for further info. |
@Rehgan, Here is the sample code to use 'library' parameter |
When I tried to use the code above to save the attached file as a csv file in python 3, the following error occurred:
IndexError: array index out of range
Test2.xlsx
The text was updated successfully, but these errors were encountered: