For older .xls
files, you can use xlrd
either you can use xlrd
directly by importing it. Like below
import xlrd
wb = xlrd.open_workbook(file_name)
Or you can also use pandas pd.read_excel()
method, but do not forget to specify the engine, though the default is xlrd
, it has to be specified.
pd.read_excel(file_name, engine = xlrd)
Both of them work for older .xls
file formats.
Infact I came across this when I used OpenPyXL
, i got the below error
InvalidFileException: openpyxl does not support the old .xls file format, please use xlrd to read this file, or convert it to the more recent .xlsx file format.