I am trying to read a macro-enabled Excel worksheet using Show
How can I resolve this error?
asked Dec 11, 2020 at 15:53
1 As noted in the release email, linked to from the release tweet and noted in large orange warning that appears on the front page of the documentation, and less orange, but still present, in the readme on the repository and the release on pypi: xlrd has explicitly removed support for anything other than xls files. In your case, the solution is to:
answered Dec 12, 2020 at 14:49
Chris WithersChris Withers 10.2k4 gold badges30 silver badges47 bronze badges 9 The previous version, xlrd 1.2.0, may appear to work, but it could also expose you to potential security vulnerabilities. With that warning out of the way, if you still want to give it a go, type the following command:
answered Dec 11, 2020 at 16:47
tryhardtryhard 2,4811 gold badge2 silver badges3 bronze badges 6 Pandas provide methods to read different file formats using a single line of code. When reading an xlsx file, rd.biffh.XLRDError: Excel xlsx file; not supported error might occur. You can solve xlrd.biffh.XLRDError: Excel xlsx file; not supported Error by updating the Pandas library version to the latest version. Now let us see the reason for this error and how to solve it. Reason For the Error The Pandas cannot open an Excel (.xlsx) file when you use the Because the versions older than 1.2.0 internally uses the xlrd library to read the excel files. The Hence, you need to use a different approach to solve this problem.
Solution 1 — Upgrading Pandas To the Latest VersionYou can solve the By default, the latest version uses the
openpyxl library. This library supports reading the To know the current Pandas library version, use the below snippet. Code
Output
You can upgrade the Pandas library to the latest version using the below statement. Code
Prefixing the
Output
The Pandas library is upgraded to the latest version, and also the dependent libraries are updated. With the latest library, you can use the read_excel() method directly to read the excel files. Use the code below to read the xlsx file or xlsm file. Code
The file will be read, and the dataframe will be populated. You can print the dataframe to see the values in the excel file. Code
Dataframe Will Look Like
This is how you need to solve the xlrd.biffh.XLRDError: Excel xlsx file; not supported Error. Solution 2 — Using Openpyxl EngineYou can use the openpyxl engine to read the xlsx file. This is an alternate way to solve the 8xlrd.biffh.XLRDError: Excel xlsx file; not supported* Error. If you do not want to upgrade the Pandas library to the latest version, you shall use this solution. However, it is always recommended to use the latest library versions to avoid security threats to your application. Install the Code
Prefixing the Output
Now, specify the
The code below demonstrates how to specify the Code
The file will be read successfully, and you can print the dataframe to see the values.
ConclusionPandas cannot open an Excel (.xlsx) file using the You’ve learned how to solve the xlrd.biffh.XLRDError: Excel xlsx file; not supported error by updating the pandas library or using the alternate engine It is also recommended to update the libraries to the latest versions to avoid any security threats to your application. You May Also Like
How do I fix xlrd Biffh XLRDError XLSX file not supported?You can solve the xlrd. biffh. XLRDError: Excel xlsx file; not supported error by upgrading the Pandas version to the latest version. 1) By default, the latest version uses the openpyxl library.
Why does xlrd not support XLSX?Support for . xlsx files was removed from xlrd due to a potential security vulnerability.
Does xlrd work with XLSX?For working with . xlsx files, there is xlrd for reading, openpyxl for reading and writing, and XlsxWriter and PyExcelerate for writing.
How do I fix xlrd error?Problem. You are have xlrd installed on your cluster and are attempting to read files in the Excel . xlsx format when you get an error. Console Copy. ... . Cause. xlrd 2.0. 0 and above can only read . xls files. ... . Solution. Use openpyxl to open . xlsx files instead of xlrd . Install the openpyxl library on your cluster.. |