重命名活动 excel 工作簿和 python 中的 sheet
Rename active excel workbook and sheet in python
是否可以在 python 中重命名活动工作簿和 sheet?
我目前正在使用 xlwings“查看”命令在 excel 中打开我的数据框,这很好,但我希望在不将其保存到指定目录的情况下命名活动的 workbook/sheet。
import xlwings as xw
xw.view(df)
当我尝试覆盖活动工作簿的全名时出现归因错误
xw.books.active.fullname = "Report"
AttributeError: can't set attribute
要重命名活动工作簿中的活动 Sheet,您可以尝试:
xw.books.active.sheets.active.name = "test"
是否可以在 python 中重命名活动工作簿和 sheet? 我目前正在使用 xlwings“查看”命令在 excel 中打开我的数据框,这很好,但我希望在不将其保存到指定目录的情况下命名活动的 workbook/sheet。
import xlwings as xw
xw.view(df)
当我尝试覆盖活动工作簿的全名时出现归因错误
xw.books.active.fullname = "Report"
AttributeError: can't set attribute
要重命名活动工作簿中的活动 Sheet,您可以尝试:
xw.books.active.sheets.active.name = "test"