Sub topic 3
Why Excel, CSV, and SharePoint Files Load in Import Mode
This chapter assumes you know the Power BI Desktop interface, can open the Power Query Editor, and understand tables, rows, columns, and data types. It explains what Import mode does, why file-based sources use it, and what that means for refresh and report size.
Storage modes in one paragraph
A storage mode decides where the data lives when someone opens a report and how visuals get their numbers. Power BI has three main modes:
- Import: Power BI copies the data into the semantic model, a compressed in-memory store. Visuals query that copy.
- DirectQuery: Power BI keeps no copy. Each visual sends a query to the source when it renders.
- Live connection: The report attaches to an existing semantic model or Analysis Services model. It does not hold its own data.
A fourth option, Dual, lets a table act as either Import or DirectQuery. It only matters in composite models, so this chapter does not cover it.
Why files use Import mode
Excel workbooks, CSV files, and SharePoint files are not query engines. A CSV file is plain text. An Excel file is a zipped package of XML. Neither one can receive a filtered, aggregated query such as "sum Amount by month for 2026" and return only the answer. The only thing you can do is read the file.
DirectQuery needs a source that can answer queries, usually a relational database. Because files cannot, the Excel, Text/CSV, SharePoint Folder, and SharePoint Online List connectors in Power BI Desktop do not offer a DirectQuery option. When you pick one of these in Get Data, the data loads in Import mode, and there is no mode choice in the navigator dialog.
SharePoint Online lists are a slight exception in kind. SharePoint exposes an API, so it is a service and not a bare file. The connector still reads the list and imports the rows, so you treat it like the file sources for this purpose.
What happens when you load
Import is a two-stage process, and it helps to keep the stages separate.
- Extract and transform. Power Query runs your applied steps against the source. It reads the file, promotes headers, sets types, and applies any cleaning.
- Load. The resulting table is compressed into the semantic model. Columns are stored in a column-oriented format, so repeated values compress well.
The diagram shows the flow, including the point where the original file is no longer involved.
Once the load finishes, visuals never touch the file. You can rename the workbook, and the report keeps working until the next refresh tries to read it.
Consequences you will notice
The data is a snapshot
The model holds the data as it was at the last refresh. If someone adds a row to the workbook on SharePoint, the report does not change until you refresh. In Desktop, you select Refresh on the Home tab. In the Power BI service, a scheduled or manual refresh does the same job.
Visuals are fast
The model is optimized for aggregation, and nothing leaves the machine or service at view time. Slicers and cross-filtering respond quickly even when the source is a slow network share.
Size limits apply
The model is held in memory, so size matters. A Pro workspace limits a published semantic model to 1 GB compressed. Premium capacities allow larger models. These limits apply to the compressed model, not to the CSV size, and a CSV often shrinks substantially. Wide text columns with many unique values compress poorly, and they are the usual cause of an oversized model.
Refresh re-reads everything
By default, a refresh reloads the whole table. For a 2 GB CSV that gains a few rows a day, that is a lot of repeated work. Incremental refresh can limit this, but it depends on date/time columns and on a source that supports query folding for best results. Files do not fold, which limits its benefit. For file sources, a more practical approach is to split data into one file per period and combine them, which a later chapter covers.
Checking what a table is doing
You can confirm a table's storage mode in Desktop:
- Switch to Model view.
- Select a table and open the Properties pane.
- Expand Advanced and read Storage mode.
For file-based tables it reads Import, and the control is unavailable for change. You can also see the same information when you hover over a table header in Model view.
Query folding does not apply to files
Query folding is when Power Query translates your steps into a native query, such as SQL, and the source does the work. A database can fold filters and aggregations. A file cannot. Every step runs inside the Power Query engine after the file has been read.
This changes how you should order steps:
- Remove unneeded columns and filter rows as early as you can. This reduces the data passed to later steps.
- Set data types once, after the structure is stable, because each step processes the table again.
- Avoid steps that force the engine to hold the whole table, such as sorting a large table before you need to, or merging large tables without a reason.
The following query reads a CSV and removes columns before it sets types. The filter and column selection reduce what later steps handle.
let
Source = Csv.Document(File.Contents("C:\Data\orders.csv"), [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]),
Promoted = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
Kept = Table.SelectColumns(Promoted, {"OrderID", "OrderDate", "Amount"}),
Typed = Table.TransformColumnTypes(Kept, {{"OrderID", Int64.Type}, {"OrderDate", type date}, {"Amount", type number}})
in
TypedThe File.Contents call reads the whole file on every refresh, whatever columns you keep. Selecting columns reduces the model size and later work, but it does not reduce the bytes read from disk.
Where the data is read from at refresh time
Import mode moves the read from view time to refresh time. That raises the question of which machine reads the file.
| Scenario | Who reads the file at refresh | What it needs |
|---|---|---|
| Refresh in Desktop | Your computer | Access to the file path and valid credentials |
| Service refresh of a SharePoint Online file | The Power BI service, over the internet | Valid credentials for SharePoint Online |
| Service refresh of a file on a local drive or file share | An on-premises data gateway | A gateway that can reach the path, plus credentials |
A path such as C:\Data\Sales.xlsx means something only on the machine that holds that drive. The Power BI service cannot read it, so a published report that uses it cannot refresh without a gateway. A SharePoint Online URL is reachable from the service, so no gateway is needed. This difference is why many teams move files to SharePoint, and a later chapter covers the gateway in detail.
Common mistakes
- Expecting live data. Users assume the report shows the current file. Say how fresh the data is, for example by adding a "Last refreshed" value to the report.
- Looking for a DirectQuery switch. There is none for these connectors. If you need near-real-time results, the data should move into a database or another source that supports it.
- Judging size by the file. A 300 MB CSV can produce a small model, and a 50 MB Excel file with long unique text can produce a large one. Check the published model size in the service.
- Publishing a local path. The report works in Desktop and fails on the first scheduled refresh in the service.
Summary of the working model
- Files cannot answer queries, so they load in Import mode.
- Refresh copies the data into the semantic model. Visuals read the copy.
- The model is a snapshot. Its age equals the time since the last successful refresh.
- Reduce columns and rows early. Folding is not available, so every step runs in the Power Query engine.
- Where the refresh runs decides whether you need a gateway.
Exercise
A colleague publishes a report built from C:\Data\Sales.xlsx on their laptop. The report opens fine in the service, but the scheduled refresh fails. Explain why the report still shows data, and name the two ways to make the refresh work.
Show answer
The report shows data because Import mode stored a copy of the table in the semantic model when it was published. Visuals read that copy, not the file. The refresh fails because the Power BI service cannot reach a path on the laptop's local drive. To fix it, either install and configure an on-premises data gateway on a machine that can reach the file, or move the workbook to SharePoint Online and change the query to read it from there, which the service can reach without a gateway.
Exercise
Why can't you choose DirectQuery for a CSV file, and why does the order of steps in a CSV query still matter?
Show answer
A CSV file is plain text and cannot run a filtered or aggregated query, so there is nothing for DirectQuery to send queries to. Query folding is also unavailable, so every step runs in the Power Query engine after the file is read. Removing columns and filtering rows early means later steps process less data and the model stays smaller.