Netho
Netho

Reputation: 25

Does excel remember existing data when importing the same data in multiple Power Queries?

I can't find the exact answer to this and I want to be certain my assumption is correct since I am to rebuild an Excel doc someone else produced.

In short, if an excel document imports from the same file path in multiple queries, does excel remember any data it already got to save memory? My assumption is no and that for each query the data will be imported again.

In terms of code, I mean something like the following:

Query1
let 
source = Folder.Files("FilePath")
#..other steps

Query2
let
source = Folder.Files("FilePath")
#..other steps

The other steps aren't so relevant to my question and don't necessarily have to be the same steps. I just want to know, since the query sources are the same, does Excel remember anything to save memory? I assume not and that it's expected for the creator to reference already imported data. I cannot find exact confirmation though.

For some context, I believe this could be one of many reasons slowing the file down so much, especially as it's more than 2 queries in my case.

Upvotes: 0

Views: 72

Answers (1)

teylyn
teylyn

Reputation: 35935

If you access the data from its original source, then it will be accessed in each query. You can use a different approach if you want to minimise the duplication.

RawDataQuery
let 
   source = Folder.Files("FilePath")
in
   source

Query1
let
source = RawDataQuery
#..other steps

Query2
let
source = RawDataQuery
#..other steps

In the early releases of Power Query, this would still load the data several times, but the more recent versions should only load the data once.

Upvotes: 1

Related Questions