Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Recoba88
Helper III
Helper III

Connect power query to name range in other workbook

Hi,

 

I want to load to power query table from other workbook. I defined  range for this table with formula (offset) - How I connect it to Power query ?

 

 

Thanks,

 

Igor

 

11 REPLIES 11
ShilajitBanerje
New Member

Hi,

 

You can define a custom function and use the below M Query if you know the location of the Range and its Sheet.

Then using the below, you can retrieve the data inside that Range in that Sheet in one shot.

 

let
Source = (Parameter1 as binary) =>
let
Source = Excel.Workbook(Parameter1, null, true),
Filtered_Rows = Table.SelectRows(Source, each ([Name] = <Name Of The Sheet>))[Data]{0}[<Column Of the Cell>]{Row of the Cell -1}
in
Filtered_Rows
in
Source

MarcelBeug
Community Champion
Community Champion

You can't.

 

You can only connect to a named range in the current workbook.

 

You can connect to tables and worksheets in other workbooks.

 

My advice would be to convert the named range to a real table.

Specializing in Power Query Formula Language (M)

I can connect to deifined range in other book if this range doesn't include formulas.

 

I can't use your suggestion cause  the number of rows in  table will change time by time and I want to bring only rows with data , not null rows

You are right with your first remark: it is possible to connect to a fixed range in another workbook.

 

I don't understand your second remark as table sizes are automatically adjusted for new and deleted data.

 

Specializing in Power Query Formula Language (M)

I don't want that power query will bring this data and then filter null rows for example

 

column1  column 2

 

1               aa

2               bb

3               cc

4

5

 

 

rows 4 and 5 for me are null rows beacuse column 2 is empty. If I use table and bring it to power query I should filter the null rows. 

 

I want to avoid using filter and bring only the 3 first rows to powe query (I wanted to do it with range and offset formula)

 

 

Ah, I understand this is a follow up on your previous question about importing data from 450 workbooks * 5 sheets each?

 

It is clear what you want, but dynamic ranges will not work for technical reasons (as explained).

 

You might consider VBA to create fixed ranges from dynamic ranges, which would not be my preference,

 

In my view, the way to go is to flter out the nulls in Power Query.

I agree, it is not very simple from multiple workbooks with multiple sheets.

Coincidentally, I created a video recentely (for another topic on this forum) to illustrate how this can be done.

For your case, you can define the filtering in the Sample Transform Query (in the video between 1:50 - 2:10), only "use first rows as headers"  is defined as transform step; here you might add filtering out the nulls).

 

With this solution, nulls will be filtered out before the tables are expanded, which is quite similar to filtering out rows at the source.

Specializing in Power Query Formula Language (M)
Recoba88
Helper III
Helper III

Hi,

 

If I use a formula in the range like offset . I can't bring this range to power query.

 

Help me

Can you provide some more detail around this?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

In the one hand you can see the whole ranges in my workbook that power query represents 

 

In the other hand you can see DATA_DRISHOT_BL - with offset formula that power query don't represent to me

 

Any Idea?

 

 

CHECK3.PNGCHECK4.PNG


@Recoba88 wrote:

In the one hand you can see the whole ranges in my workbook that power query represents 

 

In the other hand you can see DATA_DRISHOT_BL - with offset formula that power query don't represent to me

 

Any Idea?

 

 

CHECK3.PNGCHECK4.PNG


There's no such "OFFSET" in Power BI Desktop. If you could post any sample data and expected output, we can try to simulate it in Power Query.

It looks like this question is continued in a new topic?

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.