openpyxl 插入批注

# 插入批注
from openpyxl import Workbook
from openpyxl.comments import Comment

wbook=Workbook()
wsheet=wbook.active
wsheet["A1"].value = '人生苦短,我用Python'
comment = Comment("这是一个comment", "Python知识学堂")
comment.width = 300
comment.height = 50
wsheet["A1"].comment = comment
wbook.save('commented_test.xlsx')

 

posted @ 2021-05-03 15:35  正在学Python  阅读(487)  评论(0编辑  收藏  举报