I'm reading in a number of report files to create one dataframe which is working okay
cwd = os.path.abspath('')
files = os.listdir(cwd)
col_list = 'column1','column2'
df = pd.DataFrame()
for file in files:
if file.endswith('.xlsx'):
d = pd.read_excel(file,'worksheet1', usecols = col_list)
df = df.append(d, ignore_index=True)
The date that each file was created is stored in the same file but in a different sheet in cell B3. I'd like to add this value as a new column to each record for that file.
I've tried using .cell(row,column) as so:-
df = pd.DataFrame()
for file in files:
if file.endswith('.xlsx'):
d = pd.read_excel(file,'worksheet1', usecols = col_list)
d['value'] = 'worksheet2'.cell(3,2)
df = df.append(d, ignore_index=True)
but get the error AttributeError: 'str' object has no attribute 'cell'