How to download the latest excel file from sharepoint

In a sharepoint folder there will be multiple excel files but, i need to extract only latest file how can i do that one. Can anyone help me please.


You need to retrieve all excel files from the find files or folders activity then we can order by date and get the first file please try the same

latestdriveitem = Results.OrderByDescending(function(x) x.CreatedDateTime)(0)


Read all files list from sharepoint and sort them on creation time to get the desired result.


Using power shell script how we can do,
first i should login to sharepoint and then should download the latest attachment