创建新的工作簿
import xlwt
workbook=xlwt.Workbook()
sheet=workbook.add_sheet('九九乘法表')
for i in range(1,10):for j in range(1,i+1):sheet.write(i-1,j-1,'%d*%d=%d'%(i,j,i*j))
workbook.save('九九乘法表.xls')
复制已有数据表,生成新的excel,并修改内容
import xlrd
from xlutils.copy import copy
workbook=xlrd.open_workbook('九九乘法表.xls')
new_workbook=copy(workbook)
sheetOne=new_workbook.get_sheet(0)
sheetOne.write(15,0,'ehis is a test')
new_workbook.save('新九九乘法表.xls')