Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python Pandas can't read .xls file though engine is xlrd

have a 1 GB excel sheet with xls format (old excel), and I can’t read it with pandas

df = pd.read_excel("filelocation/filename.xls",engine = "xlrd")

XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'<html>\r\n'

and if removed the engine it sends this error

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

ValueError: Excel file format cannot be determined, you must specify an engine manually

any advice will be appreciated thanks

>Solution :

One of these options should work:

data = pandas.read_table(r"filelocation/filename.xls")

or

data = pandas.read_html("filelocation/filename.xls")

Otherwise, try another HTML parse, I agree with @AKX, this doesn’t look like an excel file.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading