willtrnr / pyxlsb

Excel 2007+ Binary Workbook (xlsb) reader for Python
GNU Lesser General Public License v3.0
90 stars 21 forks source link

Unable to open .xlsb workbook (zipfile.BadZipFile: File is not a zip file) #23

Closed BlackTarSalmon closed 4 years ago

BlackTarSalmon commented 4 years ago

Did pretty much the same thing as in "Usage" but the same error pops up on every single file. I tried even random files that are not .xlsb and the exact same error appears pyxlsb==1.0.6

Traceback (most recent call last): File "...", line 50, in <module> main() File "...", line 45, in main with open_workbook(source_path) as wb: File "C:\Users\...\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyxlsb\__init__.py", line 10, in open_workbook zf = ZipFile(name, 'r') File "C:\Users\...\AppData\Local\Programs\Python\Python36-32\lib\zipfile.py", line 1108, in __init__ self._RealGetContents() File "C:\Users\...\AppData\Local\Programs\Python\Python36-32\lib\zipfile.py", line 1175, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

willtrnr commented 4 years ago

Are you able to open the files in Excel or alternatively, with something like 7zip or WinRar? If that doesn't work, then your files are probably corrupted or not actually XLSB files.

BlackTarSalmon commented 4 years ago

They open in excel, definetly an xlsb file, correct relative path in code (directly copied from pycharm), tried switching to true path - same result

image image image

willtrnr commented 4 years ago

For good measure, can you try opening one of the unit test file in master: https://github.com/wwwiiilll/pyxlsb/raw/master/test_files/test.xlsb

If that worked, can you try re-saving your file with Excel as XLSB, it has a tendency to magically open "bad" files.

BlackTarSalmon commented 4 years ago

Damn it, resaving made it work... Sorry for taking your time, have a nice day