I initially have a code that is working in merging files in one folder. However, the work expanded to merge files in two folders. I edited the code to add first the list of files in two folders. That part is working but will not work in the actual for loop part. I am thinking this could be because of the current working directory but I do not know how to change that part. Here is my code so far:
files1 = os.listdir(folder1) #i just replaced the path with folder1
files2 = os.listdir(folder2) #i just replaced the path with folder2
files = files1 + files2
df = pd.DataFrame() #creating an empty dataframe
for f in files: #for loop in extracting and merging the files
data = pd.read_excel(f)
df = df.append(data, sort=False).reset_index(drop=True)