Skip to content
Home » UserWarning: Workbook contains no default style apply openpyxl’s default

UserWarning: Workbook contains no default style apply openpyxl’s default

To solve UserWarning: Workbook contains no default style apply openpyxl’s default error follow below methods.

Code

pd.read_excel(file, engine="openpyxl")

ERROR LOG

/Users/*******/projects/environments/venv/lib/python3.8/site-packages/openpyxl/styles/stylesheet.py:214: UserWarning: Workbook contains no default style, apply openpyxl's default
  warn("Workbook contains no default style, apply openpyxl's default")

How to solve UserWarning: Workbook contains no default style apply openpyxl’s default ?

To Solve the UserWarning: Workbook contains no default style, apply openpyxl’s default waring simply import the warnings module and set the ignore filter as shown below.

I don’t believe the library provides a way to disable this, thus you’ll have to use the warnings package directly.

Doing the following would be a straightforward and timely solution to the problem:


import warnings
warnings.simplefilter("ignore")

excelfile = pd.read_excel(file, engine="openpyxl")

Alternative to Solve UserWarning: Workbook contains no default style apply openpyxl’s default

If you are facing the same warning, just update the sheet name in my excel file from “sheet 1” to “Sheet1,” and the warning will be vanished. The warning is pretty similar. I believe Pandas should address this warning eventually.

Hope the above solution works.

Also read :

AttributeError: ‘SMOTE’ object has no attribute ‘_validate_data’
ModuleNotFoundError: No module named ‘imblearn’