加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
write_excel_file.py 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
tyjeon 提交于 2020-03-19 23:15 . Update write_excel_file.py
from xlwt import Workbook
import openpyxl
# Workbook is created
wb = Workbook()
# add_sheet is used to create sheet.
sheet1 = wb.add_sheet('Sheet 1')
sheet1.write(1, 0, 'ISBT DEHRADUN')
sheet1.write(2, 0, 'SHASTRADHARA')
sheet1.write(3, 0, 'CLEMEN TOWN')
sheet1.write(4, 0, 'RAJPUR ROAD')
sheet1.write(5, 0, 'CLOCK TOWER')
sheet1.write(0, 1, 'ISBT DEHRADUN')
sheet1.write(0, 2, 'SHASTRADHARA')
sheet1.write(0, 3, 'CLEMEN TOWN')
sheet1.write(0, 4, 'RAJPUR ROAD')
sheet1.write(0, 5, 'CLOCK TOWER')
wb.save('xlwt example.xls')
# Workbook is created
openpyxl_wb = openpyxl.Workbook()
# create_sheet is used to create sheet.
sheet1 = openpyxl_wb.create_sheet("Sheet 1")
sheet1.cell(1, 1, 'ISBT DEHRADUN')
sheet1.cell(2, 1, 'SHASTRADHARA')
sheet1.cell(3, 1, 'CLEMEN TOWN')
sheet1.cell(4, 1, 'RAJPUR ROAD')
sheet1.cell(5, 1, 'CLOCK TOWER')
sheet1.cell(1, 1, 'ISBT DEHRADUN')
sheet1.cell(1, 2, 'SHASTRADHARA')
sheet1.cell(1, 3, 'CLEMEN TOWN')
sheet1.cell(1, 4, 'RAJPUR ROAD')
sheet1.cell(1, 5, 'CLOCK TOWER')
openpyxl_wb.save("openpyxl example.xlsx")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化