PDA

View Full Version : Get the latest Excel file from SharePoint



Martinl2
2016-12-02, 11:54 AM
I am having trouble seeing a SharePoint Document in Power Query

I am having to use Web Query as for some reason I have not been able to navigate my way through to the correct path using SharePoint List.

If I use Web Query I can cut and paste the URL into the From Web dialogue box to take me straight to the correct webpage, however this web page does not contain all the Excel documents, they are spread over other pages. In share point I just sort on Modified descending to bring my document to the top.

As I always want the latest file (Modified is a date field) how can I add this to the source?

if I use


let
Source = Web.Page(Web.Contents(http ://a.c.b.net/xxxx/Finance/BUC/dailysales/CP/Forms/AllItems.aspx?RootFolder=%2Fxxxx%2FFinance%2FBUC%2Fdailysales%2FCP%2FArchive%20%2D%20Final%20only)),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"", type text}, {"2", type text}, {"Name", type text}, {"3", type text}, {"Modified", type date}, {"Modified By", type text}})
in
#"Changed Type"


I get just the first page I have tried adding &$orderby= Modified desc to the end but it doesn't order it
If I use SharePoint lists I cant find BUC in Finance so I cant get any further.

Any Ideas

Martin