Read the latest excel file from a folder

Hi! All,
How can I identify the latest downloaded file in a specific folder and the read it in a Microsoft Excel Input Step?

1 Like

Hi!
You can use Windows GUI Automation or secondly you can write a PowerShell or VB Script to identify the latest downloaded file in a folder.

Here is a sample code:

//Write PowerShell script from here

Get the last downloaded file.

$lastDownloadedFile = Get-ChildItem -Path “?{downloadpath}” -File | Sort-Object LastWriteTime -Descending | Select-Object -First 1

Print the file name.

Write-Host “>FieldName::$lastDownloadedFile>”

Note: Replace downloadpath with path where latest file is download

1 Like