Python 官方文档:入门教程 => 点击学习
from openpyxl import Workbookwb = Workbook()ws = wb.active'''指定sheetwb.cr
from openpyxl import Workbookwb = Workbook()ws = wb.active'''指定sheetwb.create_sheet("mySheet")ws = wb.get_sheet_by_name("mySheet")'''i = 1j = 1for val in headers:ws.cell(row=i,column=j,value=val)j = j + 1i = 2for row in data_lines:j = 1for val in row:ws.cell(row=i,column=j,value=val)j = j + 1i = i + 1### 冻结窗口,单元格上面的行和左边的列将会冻结(单元格所在的行和列不会被冻结)# 冻结第一行ws.freeze_panes = ws['A2']# 冻结第一列ws.freeze_panes = ws['B1']# 冻结第一行第一列ws.freeze_panes = ws['B2']wb.save(expfile)
--结束END--
本文标题: python openpyxl笔记
本文链接: https://lsjlt.com/news/228123.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0