问题
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