Palaeologus
Palaeologus

Reputation: 53

Changing single data source for multiple workbook queries

I have around a dozen workbook queries that extracts different information from a single data source. Recently I have had to move the data source from one location to another on my network, and this has resulted in the links breaking for all queries.

In order to fix this I have had to manually change the data source in Power Query Editor for each query, however this is a time consuming process. Is there a way to redirect all queries to the new location of the data source?

Upvotes: 0

Views: 785

Answers (1)

Olly
Olly

Reputation: 7891

As mentioned in comments, separate your file source into a single query:

Query: SourceWorkbook;

let
    Source = Excel.Workbook(File.Contents("C:\path\file.xlsx"), null, true)
in
    Source

Now your other queries refer to this query as their source:

Other Queries:

let
    Source = SourceWorkbook,
    DataTable = Source{[Item="Table1",Kind="Table"]}[Data]
    //etc
in
    DataTable

So if the actual source workbook changes, you only need to update one query.

Upvotes: 1

Related Questions