I should say from the outset that I have no coding experience but by reading hundreds of answers on this site I've managed to build since Friday evening an (almost) working set of code that does what I want.
However, I have now spent most of the afternoon puzzling over this and I can't find an answer either here or with a wider Google search.
I think I know what the problem is. In the code below when it finds a file to run through the code and append the notes list it also goes on to run through the else section. (Having studied the output I'm sure it would be too much of a coincidence if this wasn't what was happening). The problem is I've exhausted all the different things I can think of (or find from internet searches) and am still stuck.
notes = []
for index, row in df.iterrows():
prefix = (row['Work Order No'])
with os.scandir(team_folder) as files_available:
for entry in files_available:
if entry.name.startswith(prefix) and entry.name.endswith('.xlsx'):
book = load_workbook(entry)
sheet = book['Sheet1']
sheet['A1'] = row['Forecast to Complete Gross Revenue'] if \
row['Forecast to Complete Gross Revenue'] > 0 else 1
notes.append('CTC updated') if row['Forecast to Complete Gross Revenue'] > 0 else\
notes.append('CTC updated (no remaining revenue)')
book.save(entry)
else:
notes.append('No CTC file found')
Very grateful for any assistance. This is a great site and the only reason I've got as far as I have is because of this site.