Pull the Most Current Excel File in a Folder

Do you want to pull the most current Excel file in a folder? Perhaps you have a folder where team members are saving an updated version of data in a different file every day. Here is show you can dynamically pull in the most current file.

This tip is modified from this post in the Alteryx Community Site.


Start by adding the Directory Tool to your canvas. This is found in the In/Out tab of Alteryx.



Navigate to the folder where you store the xlsx files. Enter this in the Directory Field.

For File Specification enter *.xlsx*



Next you will need to add a Formula Tool to add the name of the sheet to the full path.

Select the FullPath column and enter the following formula;

[FullPath]+"|NameOfWorksheetTab"


Add a Sort Tool after the Formula Tool to sort by CreationTime and make it Descending.


Next add the Sample Tool, select First N rows and enter 1 to pull in the top file.



Finally add the Dynamic Input Tool.

Select the FullPath as the field under Read a List of Data Sources.

Ensure you select the option to Change the Entire File Path for the Action.




31 views0 comments