openpyxl cannot import load_workbook

4,309 views
Skip to first unread message

lili...@telenordigital.com

unread,
Sep 8, 2015, 1:16:09 AM9/8/15
to openpyxl-users
Dear All
I downloaded openpyxl and installed it successfully. when I run my script, it gives me error at : from openpyxl import load_workbook. the error is: cannot import name 'load_workbook'. Does anyone knows why? the version I downloaded is: pywin32-219.win32-py3.4


Charlie Clark

unread,
Sep 8, 2015, 2:35:15 AM9/8/15
to openpyx...@googlegroups.com
That looks like the version of Python you're running.

Without a full traceback or a sample file then we cannot say what the
problem may be.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

lili...@telenordigital.com

unread,
Sep 8, 2015, 3:03:06 AM9/8/15
to openpyxl-users, lili...@telenordigital.com
my script is very simple:
import openpyxl
import load_workbook

wb2 = load_workbook('fundamental_data.xlsx')
print (wb2.get_sheet_names())

the traceback is:
  File "C:\Users\Documents\Python script\Output_excel.py", line 2, in <module>
    import load_workbook
ImportError: No module named 'load_workbook'

Charlie Clark

unread,
Sep 8, 2015, 3:04:49 AM9/8/15
to openpyx...@googlegroups.com
Am .09.2015, 09:03 Uhr, schrieb <lili...@telenordigital.com>:

> my script is very simple:
> import openpyxl
> import load_workbook
> wb2 = load_workbook('fundamental_data.xlsx')
> print (wb2.get_sheet_names())
> the traceback is:
> File "C:\Users\Documents\Python script\Output_excel.py", line 2, in
> <module>
> import load_workbook
> ImportError: No module named 'load_workbook'

What don't you understand about the error?

You must import the function from the openpyxl namespace.

lili...@telenordigital.com

unread,
Sep 8, 2015, 3:05:41 AM9/8/15
to openpyxl-users, lili...@telenordigital.com
even I change my script to :
import openpyxl
from openpyxl import load_workbook
wb2 = load_workbook('fundamental_data.xlsx')

The traceback is:
  File "C:\Users\Documents\Python script\Output_excel.py", line 2, in <module>
    from openpyxl import load_workbook
ImportError: cannot import name 'load_workbook'

Charlie Clark

unread,
Sep 8, 2015, 3:07:16 AM9/8/15
to openpyx...@googlegroups.com
Am .09.2015, 09:05 Uhr, schrieb <lili...@telenordigital.com>:

> even I change my script to :
> import openpyxl
> from openpyxl import load_workbook
> wb2 = load_workbook('fundamental_data.xlsx')
> The traceback is:
> File "C:\Users\Documents\Python script\Output_excel.py", line 2, in
> <module>
> from openpyxl import load_workbook
> ImportError: cannot import name 'load_workbook'

Then you have probably installed openpyxl wrongly. Can't solve this
remotely.

lili...@telenordigital.com

unread,
Sep 8, 2015, 3:21:03 AM9/8/15
to openpyxl-users, lili...@telenordigital.com
ok, maybe something wrong with installation. Does any one mind to give me a detailed description about how to install openpyxl?
 
What I did is downloading files from  https://pypi.python.org/pypi/openpyxl/
extract the files into the folder after downloading files, and then under folder c:\python34\scripts, I run command: pip install openpyxl.. It tells me that successfully installed jdca -1.0 openpyxll -2.2.6. I also run easy_install openpyxl. it tells me :finished processing dependencies for openpyxl.

Did I do something wrong?

Charlie Clark

unread,
Sep 8, 2015, 4:21:56 AM9/8/15
to openpyx...@googlegroups.com
Am .09.2015, 09:21 Uhr, schrieb <lili...@telenordigital.com>:

> What I did is downloading files from
> https://pypi.python.org/pypi/openpyxl/
> extract the files into the folder after downloading files,

Why did you do this? And which folder?

> and then under
> folder c:\python34\scripts, I run command: pip install openpyxl.. It
> tells
> me that successfully installed jdca -1.0 openpyxll -2.2.6. I also run
> easy_install openpyxl. it tells me :finished processing dependencies for
> openpyxl.

> Did I do something wrong?

Obviously. Grabbing at straws won't help. Please follow the instructions
in the documentation.

lili...@telenordigital.com

unread,
Sep 8, 2015, 6:05:08 AM9/8/15
to openpyxl-users
Thanks a lot for your help, Charlie. It works now, hopefully what I did is correct. if it is not right, please tell me, and please in a little bit detail.
I downloaded the files again, and didn't extract them this time, just used: pip install openpyxl 

Charlie Clark

unread,
Sep 8, 2015, 6:27:14 AM9/8/15
to openpyx...@googlegroups.com
Am .09.2015, 12:05 Uhr, schrieb <lili...@telenordigital.com>:

> Thanks a lot for your help, Charlie. It works now, hopefully what I did
> is correct. if it is not right, please tell me, and please in a little
> bit
> detail.

This is standard practice for installing libraries in Python.

> I downloaded the files again, and didn't extract them this time, just
> used:
> pip install openpyxl

Why are you downloading anything in the first place? Whatever you do
download will be ignored by pip unless you point it at a download folder.

lili...@telenordigital.com

unread,
Sep 8, 2015, 6:32:00 AM9/8/15
to openpyxl-users
It says "Download......" on this page, so I thought I need to download and extract the files.

https://pypi.python.org/pypi/openpyxl/


Whatever it works now, thanks a lot for your support.

Have a nice day in Germany. :) I am in your neighbor country.

rainie...@gmail.com

unread,
Aug 30, 2018, 9:41:10 PM8/30/18
to openpyxl-users
You probably have a file named openpyxl.py in the current working directory. Rename that and deleted openpyxl.pyc
在 2015年9月8日星期二 UTC+8下午6:32:00,lili...@telenordigital.com写道:

gloria...@gmail.com

unread,
Aug 31, 2018, 2:43:28 AM8/31/18
to openpyxl-users
Hi lili

try this

_____

import openpyxl
wb2 = openpyxl.load_workbook('duplicate.xlsx')
print (wb2.sheetnames)

nehasi...@gmail.com

unread,
Aug 2, 2019, 8:03:52 AM8/2/19
to openpyxl-users

Jeff Ellis

unread,
Mar 14, 2021, 8:48:21 PM3/14/21
to openpyxl-users
just had the same issue because I stupidly named my python file the same as the name as the library! i.e. openpyxl.py, rename it if you're as stupid as me!

Paul Busing

unread,
Mar 15, 2021, 12:02:47 PM3/15/21
to openpyx...@googlegroups.com
Dear Jeff,

Thank you for the information.
I am going to try a solution with this new information.
This week I tried install pylightxl and I had no problem.

With Kindly Regards,
PaulBusing
 

Op ma 15 mrt. 2021 om 01:48 schreef Jeff Ellis <hma.je...@gmail.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "openpyxl-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openpyxl-users/Hcp_OkviFRM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpyxl-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openpyxl-users/da3e7ac1-a5b1-4917-817f-a128459b661an%40googlegroups.com.

Gabriel Leveau Queiroz

unread,
May 4, 2022, 11:28:15 PM5/4/22
to openpyxl-users
This was the one for me. Thanks!

Omar Abdelhak Mazouz

unread,
Dec 7, 2022, 1:47:12 PM12/7/22
to openpyxl-users
thanks a lot Rainie. I named my python file the same as the name as the library.

Paul Busing

unread,
Dec 7, 2022, 2:04:28 PM12/7/22
to openpyx...@googlegroups.com
Thank you for the message. 
I found that solution also, and it works now. 

Verzonden vanaf mijn Huawei-telefoon


-------- Oorspronkelijk bericht --------
Van: Omar Abdelhak Mazouz <omarma...@gmail.com>
Datum: wo 7 dec. 2022 19:47
Aan: openpyxl-users <openpyx...@googlegroups.com>
Onderwerp: Re: [openpyxl-users] Re: openpyxl cannot import load_workbook
--
You received this message because you are subscribed to a topic in the Google Groups "openpyxl-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openpyxl-users/Hcp_OkviFRM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpyxl-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages