1

Trying to read a xlsb file to create a DF in pandas.

import pandas as pd

a_data = pd.ExcelFile(
    r'C:\\Desktop\\a.xlsb')

df_data = pd.read_excel(a_data, 'Sheet1', engine='pyxlsb')
print(df.head())

When I run the script I keep getting this error.

OSError: File contains no valid workbook part

1 Answer 1

2

You can use pyxlsb, all latest version of pandas support this. Use following code:

import pandas as pd
a_data = pd.ExcelFile(r'C:\\Desktop\\a.xlsb')
df = pd.read_excel('a_data', sheet_name='Sheet1', engine='pyxlsb')

You will have to install pyxlsbfirst using command: pip install pyxlsb

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.