Why do I receive this warning message every time I run my code? (below). Is it possible to get rid of it? If so, how do I do that?
My code:
from openpyxl import load_workbook
from openpyxl import Workbook
wb = load_workbook('NFL.xlsx', data_only = True)
ws = wb.active
sh = wb["Sheet1"]
ptsDiff = (sh['J127'].value)
print ptsDiff
The code works but I get this warning message:
Warning (from warnings module):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/openpyxl/reader/worksheet.py", line 320
warn(msg)
UserWarning: Unknown extension is not supported and will be removed
It is already listed in the first answer what is wrong with it If you only want to get rid of the error that is given in red for some reason. You can go to the file location of the error and
#
the line where is says warn(msg) this will stop the error being displayed the code still works fine in my experience.I am not sure if this will work after compiled but this should work in the same machine. PS:I had the same error and this is what I did because I though it could be confusing for the end user PS:You can use a try and except error catcher too but this is quicker.This error happens when
openpyxl
cannot understand/read an extension (source). Here is the list of built-in extensionsopenpyxl
currently knows that is doesn't support:Also see the Worksheet extension list specification.
Using python 3.5 under Anaconda3, Excel 2016, Windows10 -- I had the same problem initially with an xlsx file. Tried to make it into a csv and did not work. What worked was: select the entire spreadsheet, copy on a Notepad, select the notepad text, paste in a new spreadsheet, save as xslx. It looks like any extra formatting would result in a warning.
Try to add single quotes to your data_only parameter like this:
This works for me.