Home > other >  I am a novice, please feel free to comment
I am a novice, please feel free to comment

Time:09-22

>> The import openpyxl
> The from openpyxl import workbook
Traceback (the most recent call last) :
The File "& lt; Pyshell# 1 & gt;" , the line 1, the in & lt; module>
The from openpyxl import workbook
ImportError: always import a name 'workbook' from 'openpyxl (unknown location)
> The from openpyxl import load_workbook
Traceback (the most recent call last) :
The File "& lt; Pyshell# 2 & gt;" , the line 1, the in & lt; module>
The from openpyxl import load_workbook
ImportError: always import a name 'load_workbook' from 'openpyxl (unknown location)
>


One, seems openpyxl module is installed,
Two, whether it's workbook or load_workbook all not line, I try to give a workbook, behind load_workbook put parentheses, also not line,

> The from openpyxl import load_workbook ()
SyntaxError: invalid syntax
> Wb=openpyxl. Load_workbook ()
Traceback (the most recent call last) :
The File "& lt; Pyshell# 4 & gt;" , the line 1, the in & lt; module>
Wb=openpyxl. Load_workbook ()
AttributeError: module 'openpyxl' has no attribute 'load_workbook'

Please give advice or comments,

CodePudding user response:

> Wb=openpyxl. Load_workbook (PM. XLSX)
Traceback (the most recent call last) :
The File "& lt; Pyshell# 5 & gt;" , the line 1, the in & lt; module>
Wb=openpyxl. Load_workbook (PM. XLSX)
AttributeError: module 'openpyxl' has no attribute 'load_workbook'

CodePudding user response:

The from openpyxl import load_workbook
The from openpyxl import Workbook

https://blog.csdn.net/weixin_45903952/article/details/105311722

CodePudding user response:

Wb=load_workbook (' mountains and material list. XLSX)

https://blog.csdn.net/weixin_45903952/article/details/105188176

CodePudding user response:

Try to copy the past, whether some wrong case

CodePudding user response:

Received, thanks!
Now, with the following code, commissioning to OK:
The import openpyxl
Wb=openpyxl. Load_workbook (' filename. XLSX)
Sheet=wb [' file name ']

CodePudding user response:

Sheet=wb [' file name '] here is supposed to be working table name, not the file name,

CodePudding user response:

Yes, thank you correct me,
Due to my workbook is only a table, and the name, so such a fallacy,
  • Related