Sub topic 3
Why Excel, CSV, and SharePoint files load in Import mode
This chapter assumes you know the Power BI Desktop interface and have connected to at least one file. It explains why file-based sources always load in Import mode, what that means for your report, and which errors follow from it.
What storage mode means
A storage mode decides where Power BI keeps the data a report uses. Power BI has three: Import, DirectQuery, and Dual.
- Import copies the data into the report's in-memory model (the VertiPaq engine). Visuals query that copy.
- DirectQuery sends a query to the source each time a visual needs data. Nothing is stored in the model.
- Dual lets a table act as either Import or DirectQuery, depending on the query. It only appears in models that mix sources.
Excel, Text/CSV, SharePoint Folder, and SharePoint Online List connectors offer only Import. When you pick one, Power BI Desktop does not show the Import or DirectQuery choice that you see for SQL Server.
Why files cannot use DirectQuery
DirectQuery needs a source that can answer queries. A database accepts a query, filters and aggregates the rows, and returns a small result. A file cannot do this. An Excel workbook or CSV file is a block of bytes that must be read and parsed. SharePoint stores the file but does not run queries against its contents.
So Power Query reads the whole file, applies your steps, and loads the result into the model. After that, the file is no longer involved until the next refresh.
What Import mode means for your report
- The data is a snapshot. If someone edits the workbook after you load it, the report does not change until you refresh.
- Visuals are fast. Queries run against compressed, in-memory data and do not depend on the file's location or speed.
- The data is saved in the .pbix file. When you publish, the model goes to the Power BI service with the data in it. Anyone with access to the report can see that data, even if they cannot open the original file.
- Size limits apply. The model must fit within the limits of your capacity. Loading unused columns and rows makes the model larger, so remove them in Power Query.
Seeing the mode in Power BI Desktop
You can check the mode of each table in Model view.
- Open Model view.
- Select a table and open Properties.
- Expand Advanced and read Storage mode.
It shows Import for every table loaded from these sources. The field is read-only for them, because no other mode applies.
Import mode and refresh
Because the data is a copy, a refresh must read the source again. In Desktop, select Refresh on the Home tab. Desktop runs every query, reads each file, and replaces the table contents.
In the Power BI service, a scheduled refresh does the same, but it runs on Microsoft's servers, not on your computer. That has a consequence for local files. The service cannot reach C:\Data\Sales.xlsx on your laptop. A file on SharePoint Online is reachable from the service. A later chapter covers how a gateway solves the local-file case.
Common mistakes
- Expecting live data. A report built on a CSV does not update when the CSV changes. Schedule a refresh.
- Publishing and assuming the file is needed. The published report holds its own copy. Only refresh needs the file.
- Loading everything. Import copies every column you keep. Remove columns you do not use before loading.
Exercise
A colleague connects Power BI Desktop to a CSV file, publishes the report, then deletes the CSV from their laptop. Does the published report still show data, and what happens at the next scheduled refresh?
Show answer
The report still shows data, because Import mode stored a copy in the model. The next scheduled refresh fails, because the service must read the source file again and can no longer find it.