python 操作excel 给每列批量添加 批注 怎么做 ??

坦桑尼亚奥杜威峡谷能人
测试领域新星创作者
2018-04-16 10:22:47
如题,python 操作excel 给每列批量添加 批注 怎么做 ??
...全文
1403 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
陈年椰子 2018-04-16
  • 打赏
  • 举报
回复


from openpyxl import load_workbook
from openpyxl.comments import Comment
xl_file = "d:/test.xlsx"
xl_savefile = "d:/test_save.xlsx"
if __name__ == '__main__':
    wb = load_workbook(xl_file)
    ws = wb.active
    for i in range(1,10):
        comment = Comment(u'增加批注{}'.format(i), u'陈年椰子')
        ws['A%d'%i].comment = comment
    wb.save(xl_savefile)
    wb.close()
参考改一下

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧