In a previous post we saw how to, Save an Excel File with the Current Date. In this post, we will explore the scenario to select the most recent file based on logical conditions using Alteryx.
How to Achieve it:
Let us consider a series of files, some of which are stored in different folders. We have to identify the latest file and input the data only from the latest file.
Using Alteryx, we can bring a Directory tool to read all the available files from the parent directory, make sure to enable “Include Subfolders” options. Now, sort the list of files by “LastWriteTime” column name, this will ensure the list of files are sorted in a chronological order. Next we can bring a Sample tool to select only the recent file from the list and finally the Dynamic Input tool will fetch the data from the relevant file.
This can be depicted by the workflow below.
When we run the workflow, we will get the data from the file which was last saved including those files which are placed in any subfolders.
Using Alteryx, it is possible to get data just from the latest file and ignore all the other files.