3、调用pandas库
4、使用concat()方法
5、进行sheet表连接
实现代码:
importpandasaspd importos curpath=os.path.dirname(__file__) filename=os.path.join(curpath,'example_split.xlsx') savefilename=os.path.join(curpath,'example_split_1.xlsx') df=pd.read_excel(filename,sheet_name=None) print(type(df)) dfs=[yforx,yindf.items()] writer=pd.ExcelWriter(savefilename,engine='openpyxl',mode='a') df2=pd.concat(dfs) print(df2) df2.to_excel(writer,'汇总表',index=False) writer.save()
输出结果: