Tips To Handle the Error “Workbook contains no default style, apply openpyxl’s default”

Python is a high-level programming language that has been ruling the programming world for a few decades since it is launched. In today’s world, programmers and developers can’t imagine creating web applications, game applications, machine learning, and data science projects without Python. It has, still, and will rule the world of programmers. When working with Python, programmers also use Panda, which is a Python open-source package used for machine learning and data analysis/data science tasks. It is a flexible, fast, expressive, and easy data structure and analysis tool. When you are working with Panda, you may encounter the error “workbook contains no default style, apply openpyxl’s default”.

How the error pops up

When you are working with the most recent panda version, openpyxl, and xlrd for generating an excel xlsx file, your panda readout can be:

myexcelfile = pd.read_excel(easy_payfile, engine="openpyxl")

You can simply read the file, but end up with the following error

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

Awe-inspiring Ways to Resolve “Workbook contains no default style, apply openpyxl’s default”

We have a few short and simple ways to help you solve the error. Check out them

Option 1 – Replace ‘.’ with ‘_’ in the initial name

This is one of the simplest options you can try to remove the error. For instance, the initial name you have is MDM.TARGET. Here, all you need to do is to replace the ‘.’ With ‘_’. Follow the below code

npm install

It is an effective solution to get rid of the error warning.

Option 2 – Punctual and Simple way

Another option to simply and punctually solve the issue is to implement a short code in your program. Have a look at the code that you need to follow:

import warnings

with warnings.catch_warnings(record=True):


    myexcelfile = pd.read_excel(easy_payfile, engine="openpyxl")

Though it is a minor code, when it comes to resolving the error, it is really effective. You must try this.

Option 3 – Update excel file sheet name

This is another idea to help you eliminate the error. You just need to update the excel file sheet name. The minor and simple change you need to make is to change the name to ‘Sheet1’ instead of ‘sheet 1’. This will remove the error warning. Most of the time, the error pops up only because of the excel sheet name. When you get this Python error, you should check if the sheet name you are using is correct or not. Once you set it to the right name, you can witness the error going away.


We highlighted the options to help you get through the error message “Workbook contains no default style, apply openpyxl’s default”. All the options we have added in this post are really problem-solving, and it is on you to choose the one according to the current condition and status of your project.

I hope you find it helpful! I wish you luck!

For further assistance, you can contact us by typing your concern in the below comment box. We will be delighted to help you.

Leave a Reply

Your email address will not be published. Required fields are marked *