'Worksheet' object has no attribute 'save'
时间: 2023-10-05 17:13:04 浏览: 719
'Worksheet' object没有'save'属性的原因是Worksheet对象不具备保存的功能。只有Workbook对象才有保存worksheet的函数。所以,你需要将保存代码中的对象从Worksheet改为Workbook对象。具体的更改方式如下:
```python
from openpyxl import Workbook
wb = Workbook()
wb1 = wb.active
wb.save("my.xlsx")
```
这样更改后,你就能成功保存你的工作表了。希望能对你有所帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [AttributeError: ‘DataParallel‘ object has no attribute ‘save](https://blog.csdn.net/piex_l/article/details/121915212)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [【已解决】AttributeError: ‘Worksheet‘ object has no attribute ‘save](https://blog.csdn.net/weixin_45243826/article/details/132005030)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文