Read xls file with Python pandas read excel not working says it is a xlsb file

0 votes

I'm attempting to use Apache Airflow and the read excel python pandas function to read several.xls files that are stored on a NAS storage.

This is the code I'm using:

df = pd.read_excel('folder/sub_folder_1/sub_folder_2/file_name.xls', sheet_name=April, usecols=[0,1,2,3], dtype=str, engine='xlrd')

This worked for a time, but recently I have been getting this error for several of those files:

Excel 2007 xlsb file; not supported

[...]

xlrd.biffh.XLRDError: Excel 2007 xlsb file; not supported

These files are obviously.xls files, but my code seems to be mistaking them for unsupported.xlsb files. I'd prefer a method of indicating that these are.xls files, or alternatively, a method of reading xlsb files.

I'm not sure if this is important, however, these files are updated by an outside team. If they changed a parameter without my knowledge, I could be seeing a different error, but I doubt it.

Can someone please help me with this?

Dec 17, 2022 in Others by Kithuzzz
• 38,010 points
1,382 views

1 answer to this question.

0 votes

Try:

import openpyxl

xls = pd.ExcelFile('data.xls', engine='openpyxl')
df = pd.read_excel(xls)

Recently, XLRD disabled the ability to read in various Excel datatypes, including xlxs.

answered Dec 17, 2022 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Windows 10 IE is not working with old VBA code

I discovered the answer. The issue was ...READ MORE

answered Dec 24, 2022 in Others by narikkadan
• 63,420 points
1,304 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,057 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to read A column in xlsx file with pandas?

You can view all the columns with: excel_data.head() ...READ MORE

answered Feb 9, 2023 in Others by narikkadan
• 63,420 points
367 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP