import xlrd,xlwt
from xlutils import copy
#读取excel表格某个数据
data = xlrd.open_workbook("select125.xls")
tablerd = data.sheet_by_name("Sheet1")
rowNum = tablerd.nrows #获取总行数
cellvalue=tablerd.cell_value(1,0)
print(cellvalue)
#向已经存在的excel文件写入,打开原来excel,copy一个新的后写入保存
data = xlrd.open_workbook("select125.xls")
new_data=copy.copy(data)
case_sheet=new_data.get_sheet("Sheet1")
case_sheet.write(1,3,"123")
new_data.save("select125.xls")
#创建新excel文件并且写入保存
data = xlwt.Workbook("select125.xls")
tablewt=data.add_sheet("mysheet")
tablewt.write(1,3,"123")
data.save("select126.xls")