循环路径下的文件将所有的txt文件进行合并
from xlutils.copy import copy import xlrd # 加载已存在的xls old_workbook = xlrd.open_workbook('guoshun.xlsx') # 将已存在的excel拷贝进新的excel new_workbook = copy(old_workbook) # 获取sheet new_worksheet = new_workbook.get_sheet(0) data_set=['100','10','0.1000','100','100'] # 写入数据 row = 5 # 已存在文件中的数据行数 for data in data_set: new_worksheet.write(row, 0, data) new_worksheet.write(row, 1, data) row += 1 # 将新写入的数据保存 new_workbook.save('guoshun.xlsx')