Combine multiple excel files into One

From rbachwiki
Jump to navigation Jump to search
import glob
import os
import pandas as pd
file = input('File Path: ')
pth = os.path.dirname(file)
extension = os.path.splitext(file)[1]
print(pth)
files = glob.glob(os.path.join(pth, '*.xls*'))
files

df = pd.DataFrame()

for f in files:
    data = pd.read_excel(f)
    df = df.append(data)

set(df['PDF Filename'])
df.to_excel("combined_files.xlsx")

df.shape

Back To Top - Main Category/ Excel Category