引言
项目需要
代码
import os
import pandas
sec = 0
with pandas.ExcelWriter("d:/alc/result.xlsx") as writer:
for file in os.listdir("d:/alc"):
if file.endswith('xlsx') and file != '统计.xlsx' and file != '整理.xlsx' and file != 'result.xlsx': # 忽略不需要合并的xlsx文件
print(file)
df = pandas.read_excel('d:/alc/' + file)
df.to_excel(writer, sheet_name=file.replace(".xlsx", "")) # 新的sheet名称未文件名



评论 0
还没有评论,来说点什么吧。