close

[solved] Workbook contains no default style, apply openpyxl’s default

Hello Guys, How are you all? Hope You all Are Fine. I am working with openpyxl and I got an error Workbook contains no default style, apply openpyxl’s default in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Workbook contains no default style, apply openpyxl’s default Error Occurs ?

I am working with openpyxl and I have a generated excel xlsx- file (with pandas).

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

But I do get an ugly warning :

/Users/milan/clientwork/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 Workbook contains no default style, apply openpyxl’s default Error ?

  1. How To Solve Workbook contains no default style, apply openpyxl’s default Error ?

    To Solve Workbook contains no default style, apply openpyxl’s default Error I solved this problem by just The initial name contained a . (ex: MDM.TARGET) I simply replace the . with _ and everything’s fine.

Solution 1

A simple and punctual solution to the problem would be doing:

import warnings

with warnings.catch_warnings(record=True):
    warnings.simplefilter("always")
    myexcelfile = pd.read_excel(easy_payfile, engine="openpyxl")

Solution 2

I solved this problem by just The initial name contained a . (ex: MDM.TARGET) I simply replace the . with _ and everything’s fine.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment