def combine(path, save):
excel_list = []
for name in tqdm(os.listdir(path)):
f = os.path.join(path, name)
df = pd.read_excel(f)
excel_list.append(df)
target = excel_list[-1]
for excel_f in excel_list[:-1]:
target = pd.concat([target, excel_f], axis=0)
target.to_excel(save, index=False)
if __name__ == "__main__":
path = r""
save = r"C:\Users\Desktop\combine.xlsx"
combine(path, save)
path为存放文件的文件夹,save为合成的excel路径