Based on your description of your problem, I'm assuming you mean to open and append multiple files together that have the same format and structure (i.e., have the same columns and the columns are in the same order).
In other words, you want to do something like this:
Excel worksheet 1
Col1 Col2
a b
Excel worksheet 2
Col1 Col2
c d
Merged (appended) Excel worksheet
Col1 Col2
a b
c d
If my assumptions about your problem are true, then you could try the following:
import glob
import pandas as pd
import numpy as np
import openpyxl
# This is your code
log = 'G:\Data\Hotels\hotel.txt' #text file with my long list of hotels
file = open(log, 'r')
hotels = []
line = file.readlines()
for a in line:
hotels.append(a.rstrip('\n'))
# We'll use this list to keep track of all your filepaths
filepaths = []
# I merged your 'path' and 'file' vars into a single variable ('fp')
for hotel in hotels :
# path = "G:\\Data\\Hotels\\"+hotel+"\\"+hotel+" - Meetings"
# file = hotel+"_Action_Log.xlsx"
fp = "G:\\Data\\Hotels\\"+hotel+"\\"+hotel+" -Meetings\\"+hotel+"_Action_Log.xlsx"
# print(file)
filepaths.append(fp)
# This list stores all of your worksheets (as dataframes)
worksheets = []
# Open all of your Excel worksheets as Pandas dataframes and store them in 'worksheets' to concatenate later
for filepath in filepaths:
# You may need to adjust the `skiprows` parameter; right now it's set to skip (not read) the first row of each Excel worksheet (typically the header row)
df = pd.read_excel(filepath, skiprows=1)
worksheets.append(df)
# Append all worksheets together
append = pd.concat(worksheets)
# Change 'header' to True if you want to write out column headers
append.to_excel('G:\\Data\\Hotels\\merged.xlsx', header=False)
You can learn more about the pd.concat() method here: https://pandas.pydata.org/pandas-docs/stable/merging.html