Python combines multiple excel sheets into one

After studying for a long time, I finally got it

Look at the code:

import pandas as pd
import numpy as np
import glob
filearray=[]
filelocation="file address"
for filename in glob.glob(filelocation+"*.xlsx"):
    filearray.append(filename)
res=pd.read_excel(filearray[0])
for i in range(1,len(filearray)):
    A=pd.read_excel(filearray[i])
    res=pd.concat([res,A],ignore_index=True)
print(res.index)
writer = pd.ExcelWriter('output.xlsx')
res.to_excel(writer,'sheet1')
writer.save()

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325169424&siteId=291194637