1-openpyxl基础用法
2-openpyxl单元格样式处理
3-openpyxl日期格式处理
4-openpyxl单元格合并
5-openpyxl批量操作单元格
6-openpyxl数字格式处理
openpyxl-python处理excel开源库
基础用法
pip install openpyxl
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
wb = Workbook()
filename = 'data.xlsx'
ws1 = wb.active
ws1.title = 'first sheet'
for row in range(1, 10):
ws1.append(range(10))
ws2 = wb.create_sheet(title='Data')
ws2['A1'] = 'test data'
for row in range(5, 10):
for col in range(5, 10):
ws2.cell(column=col, row=row, value='{0}{1}'.format(get_column_letter(col), row))
wb.save(filename=filename)
下一篇 openpyxl 单元格样式处理