Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python - Openpyxl - "UserWarning: Unknown extension" issue

I am trying to learn Python (day 2) and am hoping to practice with Excel books first as this is where I am comfortable/fluent.

Right off the bat I am having an error that I don't quit understand when running the below code:

import openpyxl

wb = openpyxl.load_workbook("/Users/Scott/Desktop/Workbook1.xlsx")

print(wb.sheetnames)

This does print my sheet names as requested, but it is followed by:

/Users/Scott/PycharmProjects/Excel/venv/lib/python3.7/site-packages/openpyxl/worksheet/_reader.py:293: UserWarning: Unknown extension is not supported and will be removed
  warn(msg)

I have found other questions that point to slicers/conditional formatting etc, but that does not apply here. This is a book I just made and only added 3 sheets before saving. It has no data, no formatting, and the extension is valid. I have no add-ons installed on my excel either.

Any idea why why I am getting this error? How do I resolve?

enter image description here

Python: 3.7
openpyxl: 2.6

like image 880
urdearboy Avatar asked Nov 29 '22 21:11

urdearboy


1 Answers

I had a similar issue. I developed an application which read and write Excel files. It woked well on my Windows computer, but then I tried to run it on a friends mac. It showed the same error. I could "fix" it by changing the configuration of the workbook, like this:

import openpyxl as op

wb = op.load_workbook(file, read_only=True, data_only=True)

But, as you can see, you can only read Excel files with this configuration. At the end, I realized that my friend didn't have Microsoft Office installed on his computer. Install it truly solved my problem.

like image 90
Juan David Argüello Plata Avatar answered Dec 05 '22 12:12

Juan David Argüello Plata