AttributeError: module 'openpyxl' has no attribute 'load_Workbook'

4,734 views
Skip to first unread message

nive...@gmail.com

unread,
Oct 24, 2017, 8:28:54 AM10/24/17
to openpyxl-users
I am using Python 3.6 and i have installed openpyxl 2.5.0a3. I am able to load the data into an excel using openpyxl commands.
But, I am getting the below error while trying to read from an excel.
The code I have used is,

import openpyxl
book=openpyxl.load_Workbook('sample.xlsx')

# grab the active worksheet
sheet=book.active

print(sheet[A1].value)

and the traceback I got is,

Traceback (most recent call last):
  File "C:\Users\NI009KA\Desktop\python sample codes\openxyl sample 2.py", line 2, in <module>
    book=openpyxl.load_Workbook('sample.xlsx')
AttributeError: module 'openpyxl' has no attribute 'load_Workbook'

And I have installed openpyxl according to the document provided only.

Kindly help

Charlie Clark

unread,
Oct 24, 2017, 9:30:49 AM10/24/17
to openpyx...@googlegroups.com
Am .10.2017, 14:28 Uhr, schrieb <nive...@gmail.com>:

> File "C:\Users\NI009KA\Desktop\python sample codes\openxyl sample
> 2.py",

Looks like you have named your project "openpyxl". If you rename it to
something else it should work.

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

Nivi

unread,
Oct 24, 2017, 9:40:29 AM10/24/17
to openpyxl-users
Thanks for the reply Charlie. I changed the name to extractdata.py and executed again. I am still getting the below error,

Traceback (most recent call last):
  File "C:\Users\NI009KA\Desktop\python sample codes\extraactdata.py", line 2, in <module>
    book=openpyxl.load_Workbook('sample.xlsx')
AttributeError: module 'openpyxl' has no attribute 'load_Workbook'


Charlie Clark

unread,
Oct 24, 2017, 9:43:00 AM10/24/17
to openpyx...@googlegroups.com
Am .10.2017, 15:40 Uhr, schrieb Nivi <nive...@gmail.com>:

> Thanks for the reply Charlie. I changed the name to extractdata.py and
> executed again. I am still getting the below error,

Sorry, I haven't got a better idea other than it's related to how your
project is set up.

Nivi

unread,
Oct 24, 2017, 10:35:39 AM10/24/17
to openpyxl-users
Thanks again for the reply

Thomas Nygårds

unread,
Oct 31, 2017, 9:22:43 AM10/31/17
to openpyxl-users
Hi Nivi.

It is easy to miss but, I think the reason is that you are using a capital letter W.
Instead of

book=openpyxl.load_Workbook('sample.xlsx')

you should use:

book=openpyxl.load_workbook('sample.xlsx')


Regards
Thomas

Nivi

unread,
Nov 2, 2017, 8:26:55 AM11/2/17
to openpyxl-users

OMG its working now after changing. Thanks a lot for your help Thomas.

o.elsh...@gmail.com

unread,
Dec 25, 2018, 7:59:34 AM12/25/18
to openpyxl-users
hi, sorry for bothering, 
i have the same issue although it's a small w 

    civil = openpyxl.load_workbook("test.xlsx")
AttributeError: module 'openpyxl' has no attribute 'load_workbook'

do you have any idea this code used to work before.
i upgraded to python 3.7.2 
upgraded to the latest openpyxl

vsol...@gmail.com

unread,
Feb 16, 2019, 1:14:52 AM2/16/19
to openpyxl-users
thanks

gkku...@gmail.com

unread,
Feb 20, 2019, 5:58:50 AM2/20/19
to openpyxl-users
I got an error, related to openpyxl, please find the below error message:
AttributeError: module 'openpyxl' has no attribute 'charts'

and I'm using openpyxl version: 2.6.0, checked that charts module not exists, and using Python version 3.6
so, if anyone knows how to fix please help me. Thanks in advance.

Regards,
Kiran

Peter Larsen

unread,
Nov 1, 2022, 9:04:03 AM11/1/22
to openpyxl-users
not sure if this matters, but when I look at my code the 'load_Workbook' has a lowercase w.

Peter
Reply all
Reply to author
Forward
0 new messages