'merge multiple excel file into one_python

Can anyone help in optimizing a code which should merge multiple excel files into a single master file? The below code is working but takes lot of time (more than 30 min) to complete the merge:

import glob
import pandas as pd

path = r"mypath"
file_list = glob.glob(path + "/*.xlsx")
excl_list = []
for file in file_list:
    excl_list.append(pd.read_excel(file, dtype='unicode', engine='openpyxl'))
excl_merged = pd.DataFrame()
for excl_file in excl_list:
    excl_merged = excl_merged.append(excl_file, ignore_index=True)
excl_merged.to_excel(r'mypath\combinedFile.xlsx, index=False)

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source