How to deal with warning : “Workbook contains no default style, apply openpyxl’s default “

We Are Going To Discuss About How to deal with warning : “Workbook contains no default style, apply openpyxl’s default “. So lets Start this Python Article.

How to deal with warning : “Workbook contains no default style, apply openpyxl’s default “

  1. How to solve How to deal with warning : “Workbook contains no default style, apply openpyxl's default “

    I don't think the library offers you a way to disable this thus you are going to need to use the warnings package directly.
    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")

  2. How to deal with warning : “Workbook contains no default style, apply openpyxl's default “

    I don't think the library offers you a way to disable this thus you are going to need to use the warnings package directly.
    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 1

I don’t think the library offers you a way to disable this thus you are going to need to use the warnings package directly.

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")

Original Author ruhanbidart Of This Content

Solution 2

df=pd.read_excel("my.xlsx",engine="openpyxl") passing the engine parameter got rid of the warning for me. Default = None, so I think it is just warning you that it using openpyxl for default style.

Original Author Jose Urena Of This Content

Solution 3

@ruhanbidart solution is better, but if you have dozens of calls to pd.read_excel, you can simply:

import warnings
warnings.simplefilter("ignore")

Original Author neves Of This Content

Solution 4

I had the exact same warning and was unable to read the file. In my case the problem was coming from the Sheet name in the Excel file.

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

Original Author Yoan B. M.Sc Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment