click here
click here

Reputation: 836

Use different source if Power Query refresh fails

Sometimes users have authentication issues with a SharePoint list.

I would like PowerQuery to try to get data from that list but if it fails I would like it to pull from an Excel file on the network. (which I would just update manually once per week)

How would I do this?

Upvotes: 0

Views: 78

Answers (1)

Mike Honey
Mike Honey

Reputation: 15027

Power Query's M/PQL language has a try expression for error handling:

https://msdn.microsoft.com/en-us/library/mt186368.aspx

I would try to edit the Query script to have 2 Source statements (SPO & Excel) with try expressions, then choose between them in a later step, e.g.

... SourceSPList = try SharePoint.Tables( ...
... SourceExcel = try Excel.Workbook( ...
... if SourceSPList[HasError] then SourceExcel[Value] else SourceSPList[Value]

Good luck with this - M/PQL raw coding about is the most miserable coding experience around ...

Upvotes: 1

Related Questions