Sub topic 13
Refreshing in the Power BI service: when you need a gateway
This chapter assumes you can build a Power BI Desktop report from Excel, CSV, or SharePoint sources. It also assumes you know what an applied step is and have seen the credentials dialog. Here you will learn what a scheduled refresh in the Power BI service needs for each kind of file source.
What refresh does
Power BI Desktop stores a copy of your data in the report (Import mode). After you publish, the semantic model in the service holds that copy. A refresh reruns the Power Query steps against the source and replaces the stored data.
The service must reach the source to do this. Your laptop is not involved. So the question is always: can the Power BI service, running in the cloud, open this file?
Local files need a gateway
A path such as C:\Data\orders.csv exists only on your machine or on a server inside your network. The cloud service cannot reach it. An on-premises data gateway is software you install on a computer that can see the file. The service sends refresh requests to the gateway, and the gateway reads the file and returns the data.
Local file sources need these things:
- A gateway that is online and registered to your organization.
- A data source entry on the gateway that matches the file path in the query.
- Credentials for that source, typically a Windows account that can read the folder.
- A gateway machine that can open the same path. A drive letter mapped only on your laptop will fail. A UNC path such as
\\server\share\is safer.
SharePoint Online files need no gateway
SharePoint Online is already in the cloud, so the service connects to it directly. A query that uses SharePoint.Files or SharePoint.Tables refreshes without a gateway. You sign in with an organizational account, and the service stores that credential.
let
Source = SharePoint.Files("https://contoso.sharepoint.com/sites/Sales", [ApiVersion = 15]),
FileContent = Source{[Name = "Sales.xlsx", #"Folder Path" = "https://contoso.sharepoint.com/sites/Sales/Shared Documents/"]}[Content],
Workbook = Excel.Workbook(FileContent, true, true),
SalesTable = Workbook{[Item = "Sales", Kind = "Table"]}[Data]
in
SalesTableThis is why moving a file from a laptop to SharePoint is often the simplest way to get a scheduled refresh working.
Setting up the schedule
- Publish the report from Power BI Desktop to a workspace.
- In the service, open the semantic model's settings.
- Under Gateway and cloud connections, choose the gateway (local files only) or confirm the cloud connection (SharePoint).
- Under Data source credentials, sign in or enter the account for each source.
- Under Refresh, turn on the schedule and pick the times.
Common blockers
| Symptom | Likely cause |
|---|---|
| Gateway option is missing or greyed out | The gateway is offline, or you are not allowed to use it |
| Credentials error after publishing | The source was never signed in to in the service |
| Path not found on refresh | The gateway machine cannot reach the path used in the query |
| Works in Desktop, fails online | The file is open only on your laptop, or a parameter points to a local path |
Exercise
Your report reads Sales.xlsx from a SharePoint Online document library using SharePoint.Files. A colleague says you must install a gateway before scheduling a refresh. Are they right? What would change if the file were at C:\Data\Sales.xlsx?
Show answer
They are not right. SharePoint Online is reachable by the Power BI service directly, so you only need valid organizational credentials on the semantic model. If the file were at C:\Data\Sales.xlsx, the service could not reach it, so you would need an on-premises data gateway on a machine that can open that path, plus a matching data source and credentials.
Exercise
A scheduled refresh of a CSV on a network share fails with "path not found", although it works in Desktop. Name two things to check.
Show answer
Check that the gateway is online and that the gateway machine can open the same path. A drive letter mapped only on your laptop will not exist there, so use a UNC path. You can also check that the data source credentials in the service can read the share.