Tag Archives: openpyxl

The problem of error reporting when importing openpyxl from Python has finally been solved

Problem: after tossing all morning, openpyxl has been installed and uninstalled many times. The CMD clearly shows that the installation is successful, but an error is reported when the python file is imported

1. After installing openpyxl, the python file import has been reporting errors. After a morning’s efforts, I finally found the correct solution on the Internet

2. After installing openpyxl, you need to add components to pycharm. The steps are as follows

    Help—> In findaction, enter the project interpreter and open the project interpreter

3. Click the “+” sign on the right

 

 

 

4. Enter the available packages interface, enter openpyxl in the input box, and click Install Package below. Later, you will be prompted with “package ‘openpyxl’ install successfully” below

 

5. At this time, if you import openpyxl in Python, you will not report an error

 ( Note: when other packages report errors (such as pandas), import them in DOS Python environment first. If no errors are reported; Then repeat the above steps in pycharm — project interpreter and install the corresponding package.)

Problems and solutions of typeerror: ‘generator’ object is not subscriptable in openpyxl

Today, a package called openpyxl was used to parse the excel data to build the driver data framework.
Then the TypeError:’generator’ object is not subscriptable bug

appeared . The specific problem in the above picture appeared in print(pe.getCellOfObject(sheet, rowNo=1 , colsNo=1)) After
checking the code for a long time, there is no problem. Finally, I asked Du Niang to find out that it was the version number.
Since I installed the version of openpyxl3.0.0, I just need to replace the 2.3.3 or 2.3.5 version.

Solution: 

It is recommended to change the version of openpyxl to 2.3.3 or 2.3.5