Aug-19-2021, 03:08 PM
import os import pandas as pd cwd = os.path.abspath('K:\\ExternalLinkValidationReports\\UK\\2020-01-06') 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('Appended Reports.xlsx')So far I've managed to create an appended report that collects and appends all the Excel files in K:\\ExternalLinkValidationReports\\UK\\2020-01-06
However, I want to modify this so that it looks for the latest modified folder in K:\\ExternalLinkValidationReports\\UK\\
rather than having to specify the exact folder each time.
I wonder if anyone knows a quick way to modify my code so that it can do this?
Many thanks!
John