Hello All,
How to create a workflow that reads the latest file from the shared directory.
- Scenario
I have two files coming into my shared directory daily but I want to pick one of the files and want to make this dynamic going forward. In the below example
XYZ.xlsx - 04:05:28
ABC.xlsx - 04:05:20
Solved! Go to Solution.
Hello,
Use the Directory Tool. Select the Directory and specify .xlsx in your case.
Use a sort tool to sort by creation time.
Use the sample tool get either the first or last row based on how you sorted.
Use the Dynamic Input tool and specify Field: As the value you created with the full path name.
Hi @suby I mocked up a workflow let me know what you think?
Thanks for sharing this and I'm quite new to Alteryx and would it be possible to explain me the steps on what it does and which one applies to my scenario.
Also in my case sometimes the 2 files copied in my shared directory the order of copy might be different in time sometime XYZ can be copied earlier than ABC file and vice versa.
Hi @suby I amended the workflow with comments along the steps.
Hello,
Thanks unable to open the file.
Thanks
Hello,
Pop up error message.
Failure to Import C:\Users\44130112\AppData\Local\Microsoft\Windows\INetCache\IE\JZ9XXCW6\Dynamic_Read_22072020 (4).yxzp.
There was an error opening "C:\Users\44130112\AppData\Local\Microsoft\Windows\INetCache\IE\JZ9XXCW6\Dynamic_Read_22072020 (4)\Dynamic_Read_22072020.yxmd":
This workflow was created by a more recent version of Alteryx, and may contain tools or functionality not present in this version. Alteryx does not support using an earlier version of Alteryx to open a workflow created with a newer version. For best results, download the latest version of Alteryx.
Thanks
I managed to open the workflow and I followed the same Steps in your workflow and when it comes to sample tool I get the list of file names on the output is
XYZ.xlsx - 04:05:28
but I want the ABC.xlsx - 04:05:20
Also please explain what the workflow does after the sample tool I'm still struggling to understand.
Thanks
Hi @suby if you want the ABC.xlsx - 04:05:20 then amend the Sort tool to relevant datetime field that you are getting from the directory tool. Eg if 04:05:20 is creation time change the Sort Tool to ascending or descending so that file appear on top before the sample tool. Or you can use a filter tool if you always want that specific file. The workflow after the sample tool is extracting the list of excel sheets names from the specific file then reading it in the dynamic input. I've done this as you need to know the file name and sheet name when you are working with excel files in Alteryx.