excel的处理

# -*- coding: utf8 -*-
import xlrd
import xlsxwriter
data = xlrd.open_workbook( "00-KIDSWANT-basis-20141114_双周计画.xls".decode('utf8').encode('gbk') )
table = data.sheets()[0]
nrows = table.nrows
ncols = table.ncols
workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet()


for i in range(nrows):
    for k in range(ncols+1):
        if k < ncols:
            table.put_cell(i,k,1,table.cell(i,k).value,0)
            worksheet.write(i,k,table.cell(i,k).value)
        else:
            worksheet.write(i,k,"hi")
workbook.close()













上一篇:python3-操作excel文件内容


下一篇:c#将数据导出成excel表格