Skip to content

BUG: Cannot read XLSX files with xlrd version 2.0.0 #38410

Closed
@keiv-fly

Description

@keiv-fly

Code that fails with xlrd==2.0.0:

pd.read_excel("file.xlsx")
raises the error: XLRDError: Excel xlsx file; not supported

The documentation for xlrd==2.0.0 says that it does not support any other files other than "xls"
xlrd updated their version today on 2020-12-11

/local_disk0/.ephemeral_nfs/envs/pythonEnv-1e568db2-af63-4098-8ee9-a8375bd77616/lib/python3.7/site-packages/pandas/io/excel/_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols, **kwds)
    302 
    303     if not isinstance(io, ExcelFile):
--> 304         io = ExcelFile(io, engine=engine)
    305     elif engine and engine != io.engine:
    306         raise ValueError(

/local_disk0/.ephemeral_nfs/envs/pythonEnv-1e568db2-af63-4098-8ee9-a8375bd77616/lib/python3.7/site-packages/pandas/io/excel/_base.py in __init__(self, io, engine)
    819         self._io = stringify_path(io)
    820 
--> 821         self._reader = self._engines[engine](self._io)
    822 
    823     def __fspath__(self):

/local_disk0/.ephemeral_nfs/envs/pythonEnv-1e568db2-af63-4098-8ee9-a8375bd77616/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py in __init__(self, filepath_or_buffer)
     19         err_msg = "Install xlrd >= 1.0.0 for Excel support"
     20         import_optional_dependency("xlrd", extra=err_msg)
---> 21         super().__init__(filepath_or_buffer)
     22 
     23     @property

/local_disk0/.ephemeral_nfs/envs/pythonEnv-1e568db2-af63-4098-8ee9-a8375bd77616/lib/python3.7/site-packages/pandas/io/excel/_base.py in __init__(self, filepath_or_buffer)
    351             self.book = self.load_workbook(filepath_or_buffer)
    352         elif isinstance(filepath_or_buffer, str):
--> 353             self.book = self.load_workbook(filepath_or_buffer)
    354         elif isinstance(filepath_or_buffer, bytes):
    355             self.book = self.load_workbook(BytesIO(filepath_or_buffer))

/local_disk0/.ephemeral_nfs/envs/pythonEnv-1e568db2-af63-4098-8ee9-a8375bd77616/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py in load_workbook(self, filepath_or_buffer)
     34             return open_workbook(file_contents=data)
     35         else:
---> 36             return open_workbook(filepath_or_buffer)
     37 
     38     @property

/local_disk0/.ephemeral_nfs/envs/pythonEnv-1e568db2-af63-4098-8ee9-a8375bd77616/lib/python3.7/site-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows, ignore_workbook_corruption)
    168     # files that xlrd can parse don't start with the expected signature.
    169     if file_format and file_format != 'xls':
--> 170         raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
    171 
    172     bk = open_workbook_xls(

XLRDError: Excel xlsx file; not supported

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions