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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RafaelKnuth
Advocate I
Advocate I

Importing M Power Queries from Excel 2016 into Power BI

I wrote several M Power Queries in Excel, and I want to import those into Power BI.

These queries are connections only, they are not loaded as tables into my Excel workbook.

 

In case of a workbook, the corresponding M Power Queries get loaded into Power BI.

But I only need the M Power Queries.

 

Is there a workaround?

 

Any feedback highly appreciated. Thanks!

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

Hmm, I can't find any way to get to the underlying "M" code for queries in Excel. If you could, then it would be a simple copy and paste into the Advanced Editor.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks, there are some limits to copy and paste thogh, as I want to import Queries by the dozens 😉 So, this certainly works with few Queries, but that workaround becomes hugely error-prone when juggling with many Queries at once.

Put your queries in a folder, then copy and paste the whole folder. I've tested this between Excel, Power BI, and Visual Studio (SSAS). See this thread and its screenshots where I show where in the UI you can do it:

https://community.powerbi.com/t5/Desktop/Ways-to-share-Power-Query-queries-between-PBI-Excel-SSAS-Co...

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Thanks! One dumb question though: How do I create a folder for my queries in Excel?

I wasn't able to figure that out by myself.

 

(I am totally new to M ... and I didn't know much more than how to use the SUM function until recently)

@RafaelKnuth In the Query Editor, right click on the Queries left panel and select "New Group...", as per the screenshot below:

 

pq-group.png

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Hi,

 

so, here's what I did step by step:

 

1. Create new group in Excel

c1.PNG

 

 

2. Load query group into Power BI

 

c2.PNG

3. But what I see then is this

 

c3.PNG

 

I am not qute sure what to do with this. Can you advise? Thank you so much for your effort!

Looks like you loaded the spreadsheet from Get Data? That's an entirely different workflow. What I was suggesting is to just copy and paste your query group from one Query Editor to the other. Right click on "Beginner Queries" in the Excel query editor and select Copy. Then right click in the query pane in Power BI and select Paste,

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

My bad, thanks! Got it now. It works.

But there is no way to share queries with other users, say, if I wanted to share my queries with you or vice versa?

The solution you described only works on one and the same system.

Correct, what I gave you is a single-user desktop shortcut.

 

You can share queries in the Azure data catalog from Excel, but that's not supported as a query source directly from Power BI Desktop, even though you need a Power BI Pro license to post queries from Excel to Azure Data Catalog!

 

Excel 2016 screenshot:

 

data-catalog.png

 

But then in Azure Data Catalog the "Open In" menu is greyed out:

 

ADC.png

 

Normally it should list Power BI Desktop like in the example below (which is a SQL source, not a PQ query):

 

adc-pbi.png

 

Frankly the whole experience is very confusing, I've found ADC very slow, and it feels like they stopped development in the middle of doing it. Feels like a poor handover from the Office team to the Azure team that can only make sense to insiders within the involved teams.

 

See this thread:

https://community.powerbi.com/t5/Desktop/Ways-to-share-Power-Query-queries-between-PBI-Excel-SSAS-Co...

 

And this thread:

https://community.powerbi.com/t5/Desktop/Data-catalog-integration-with-Power-BI/td-p/235160

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.