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
• 29,080 points
179 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
• 53,920 points

Related Questions In Others

0 votes
0 answers

How to read A column in xlsx file with pandas?

I understand how to read a column ...READ MORE

24 minutes ago in Others by Kithuzzz
• 29,080 points
2 views
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
• 53,920 points
114 views
0 votes
1 answer

Is there a way to test a formula result in excel and type it only once, all within one cell and not using a user defined function?

Use the Let function: =LET(Value,A1+B2+C4+G3+B4,IF(Value>10,"No",Value)) I hope this helps ...READ MORE

answered Jan 9 in Others by narikkadan
• 53,920 points
41 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 3,329 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
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