Sep-06-2020, 07:14 PM
We are new to Python script and need to merge 50+ excel files into one workbook. Have searched for suitable code and have edited to suit our data & folder structure but have now got same 'file not found' error on 2 different PCs. Code is below! Any advice welcome! Thanks J&M
FileNotFoundError: [Errno 2] No such file or directory: 'Test_Excel_1.xlsx'
import os
import pandas as pd
cwd = os.path.abspath(' ')
files = os.listdir(cwd)
df = pd.DataFrame()
for file in files:
if file.endswith('.xlsx'):
df = df.append(pd.read_excel(file), ignore_index=True)
df.head()
df.to_excel('Merge.xlsx')ErrorFileNotFoundError: [Errno 2] No such file or directory: 'Test_Excel_1.xlsx'
