pandas实现两个excel的sheet合并到另一张表中
import pandas as pd
def combine_excel(file_path1,file_path2,target_path):
#文件读入
data1 = pd.read_excel(file_path1)
data2 = pd.read_excel(file_path2)
target_file = pd.ExcelWriter(target_path)
data1.to_excel(result,sheet_name = "sheetname1",index = False)
data2.to_excel(result,sheet_name = "sheetname2",index = False)
return result
#调用函数
combine(file_path1,file_path2,target_path)
result.save()