NameError: name 'Workbook' is not defined
时间: 2023-11-03 18:56:17 浏览: 617
这个错误通常是由于没有正确导入openpyxl模块导致的。在你调用Workbook对象时,Python会查找你是否已经导入了openpyxl模块。因此,你需要在你的代码中添加以下行来导入openpyxl模块:
import openpyxl
这将解决NameError: name 'Workbook' is not defined的问题,并允许你使用Workbook对象。请确保在调用Workbook之前导入openpyxl模块。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [python xlsx处理openpyxl](https://blog.csdn.net/mengtianwxs/article/details/53202367)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文