python合并多个excel表格到一张表中

import pandas as pd
import os

pwb = "D:/PY/合并文件"
df_list = []

for path, dirs, files, in os.walk(pwb):
    for file in files:
        file_path = os.path.join(path, file)
        df = pd.read_excel(file_path)
        df_list.append(df)
result = pd.concat(df_list)
print(result)
result.to_excel("D:/PY/合并文件/汇总表.xlsx", index=False)

你可能感兴趣的:(python合并多个excel表格到一张表中)