Openpyxl - object has no attribute 'load_workbook'

有些话、适合烂在心里 提交于 2020-05-29 01:09:37

问题


I'm trying to load an existing workbook using openpyxl. But when I'm trying to run this code - I'm getting following error:

AttributeError: 'module' object has no attribute 'load_workbook'

import openpyxl works fine, what I'm doing wrong?


回答1:


The examples are for a later version of openpyxl. In 1.1.4 the main __init__.py did not provide a shortcut to load_workbook in the form of

from openpyxl.reader.excel import load_workbook

so you will have to do that instead of:

from openpyxl import load_workbook

what is shown in the example.



来源:https://stackoverflow.com/questions/13000128/openpyxl-object-has-no-attribute-load-workbook

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!