Do documentation https://openpyxl.readthedocs.io/en/default/

installed via pip install openpyxl

from openpyxl import Workbook wb = Workbook() 

and is not imported:

 Traceback (most recent call last): File "D:/OneDrive/WORC/Python/bitrix24/report/openpyxl.py", line 3, in <module> from openpyxl import Workbook File "D:\OneDrive\WORC\Python\bitrix24\report\openpyxl.py", line 3, in <module> from openpyxl import Workbook ImportError: cannot import name 'Workbook' 

I tried to replace my Workbook with a workbook and it still doesn’t work

openpyxl version 2.4.5 python 3.6.0

Reported as a duplicate by jfs python Apr 3 '18 at 12:16 pm

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • one
    Start pip freeze and check if openpyxl is installed. Затем C:/OneDrive/WORC/Python/Scripts/pip.exe freeze and again verify that the library is there. You can also check what exactly you are running with the command where pip . The library could be installed on some other interpreter, which lies elsewhere. You can look at virtualenv for the future to avoid confusion. - m9_psy
  • Your file is named openpyxl.py which conflicts with the Python package of the same name. - jfs

1 answer 1

Yes, through pip freeze, I see that openpyxl is installed, the whole thing I originally had on virtualenv, other packages installed in the same virtualenv work

In general, I solved the problem by downloading openpyxl and putting it in the folder with the project.