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

Time:10-11

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

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

any advice will be appreciated thanks

CodePudding user response:

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.

  • Related