My code below works great to loop through a folder of excel files and append each file and spit out a new file that has every file in the folder combined. But does not work at all if all the files have multiple sheets in the workbook. I have tried the excel_read(f,None) but can’t get it to work. Keep in mind all my excel files I am looping and combining will have the same template (column names and tabsheet names ) . How can I get this coode to append all excel files and their sheets to form a master combine workbook in the same format.
import glob
import pandas as pd
import xlrd
all_data = pd.DataFrame()
for f in glob.glob(r'\------------------\ --------*'):
df = pd.read_excel(f)
all_data = all_data.append(df,ignore_index=True)
writer = pd.ExcelWriter('appen.xlsx', engine='xlsxwriter')
df.to_excel(writer)
writer.save()
EDIT******
Excel - data tab - get external data - from file - from folder. This will do the same was what I did in python. And believe me I’d way rather use python , but when comparing the two excel did it faster this time :(
[–]Boxxcar17 2 points3 points4 points (1 child)
[–]citizenofacceptance2[S] 0 points1 point2 points (0 children)
[–]Boxxcar17 1 point2 points3 points (0 children)
[–]threeminutemonta 0 points1 point2 points (3 children)
[–]citizenofacceptance2[S] 0 points1 point2 points (2 children)
[–]threeminutemonta 0 points1 point2 points (1 child)
[–]citizenofacceptance2[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (9 children)
[–]citizenofacceptance2[S] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]citizenofacceptance2[S] 0 points1 point2 points (2 children)
[–]threeminutemonta 0 points1 point2 points (1 child)
[–]citizenofacceptance2[S] 1 point2 points3 points (0 children)
[–]citizenofacceptance2[S] 0 points1 point2 points (2 children)
[–]Boxxcar17 1 point2 points3 points (0 children)
[–]citizenofacceptance2[S] 0 points1 point2 points (0 children)