Python combine all excel files in folder

Python script that will loop all the excel files in a folder and combine them into 1 file.  Then writes the combined file back to the folder.

 

import pandas as pd

import glob
filelist = glob.glob('Z:\\Desktop\\Folder\\*.xlsx')
file1 = ""

for i in  filelist: 
   file2 = pd.read_excel(i,sheetname="Sheet1",parse_cols="B:D") 
   files2['FileName'] = i 
   file1 = new_df 
   new_df = file1.append(file2) 
   print i


writer = pd.ExcelWriter("Z:\\Desktop\\Folder\\Export.xlsx")
new_df.to_excel(writer,'All')
writer.save()

Interested in learning new skills?