Home > front end >  Merge all excel files into one file with multiple sheets
Merge all excel files into one file with multiple sheets

Time:12-02

i would like some help.

I have multiple excel files, each file only has one sheet.

I would like to combine all excel files into just one file but with multiple sheets one sheet per excel file keeping the same sheet names.

this is what i have so far:

import pandas as pd
from glob import glob
import os


excelWriter =  pd.ExcelWriter("multiple_sheets.xlsx",engine='xlsxwriter')



for file in glob('*.xlsx'):
    df = pd.read_excel(file)
    df.to_excel(excelWriter,sheet_name=file,index=False)
excelWriter.save()

All the excel files looks like this:

enter image description here

  • Related