美文网首页
python 生成excel 设置密码

python 生成excel 设置密码

作者: TcAlan | 来源:发表于2022-05-06 19:04 被阅读0次

from openpyxl import Workbook

wb = Workbook() # 创建一个工作表
ws = wb.active # ws操作sheet页
ws1 = wb.create_sheet('Mysheetfirst', 0)

ws1.protection.sheet = True
ws1.protection.password = '1234567890'
ws1.protection.enable()

---------------------------------------------------------

ws1['A1'] = 'juankuan'
ws1['E1'] = '中国'
ws1['F1'] = '2020-02-27-09-51-02'

-----------------------------------------------

wb.save('xxxxxx.xlsx')

相关文章

网友评论

      本文标题:python 生成excel 设置密码

      本文链接:https://www.haomeiwen.com/subject/ctuzyrtx.html