How to deal with warning : "Workbook contains no default style, apply openpyxl's default " How to deal with warning : "Workbook contains no default style, apply openpyxl's default " python python

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 warningswith warnings.catch_warnings(record=True):    warnings.simplefilter("always")    myexcelfile = pd.read_excel(easy_payfile, engine="openpyxl")


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.


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

import warningswarnings.simplefilter("ignore")