- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to import multiple power queries *.pq files into power bi?
Hi,
i have a lot of power queries *.pq files created in Power Query SDK.
How to import M Code from all of them as separated queries into Power Bi Desktop?
So i have Query1, Query2, Query 3 M code tested and checked in power Query SDK.
Now i want to get them in Power Query editor in Power BI with the same M code (replace or create new power queries while importing).
How to do this?
Best,
Jacek
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I solve the case!!
To programmatically interact with power queries you can modify existing M code using TMDL approach:
https://powerbi.microsoft.com/en-us/blog/tmdl-in-power-bi-desktop-developer-mode-preview/
Best,
Jacek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jaryszek,
Thank you for your valuable feedback. We understand that the lack of an automated solution poses a challenge, and we sincerely appreciate the efforts invested in exploring possible alternatives. While there is no officially documented method to automate this process, we encourage staying updated with Power BI developments and actively engaging in community forums, where new tools or solutions may be introduced.
In the meantime, if a feasible solution is discovered, we would appreciate it if it could be shared with the community, as it may benefit others facing similar challenges.We appreciate the patience and understanding.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jaryszek,
We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.
If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I solve the case!!
To programmatically interact with power queries you can modify existing M code using TMDL approach:
https://powerbi.microsoft.com/en-us/blog/tmdl-in-power-bi-desktop-developer-mode-preview/
Best,
Jacek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks! Query is not resolved yet because there is no option to automate the process.
Looking for solution - if I will find it - i will close the topic.
Best,
Jacek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jaryszek,
Thank you for your acknowledgment.
Based on my research, I have not found any official documentation to automate the process using PowerShell or any other programming language. As an alternative, we can proceed with the proposed solution.
If you have discovered a method to automate the process, we kindly request you to share it with the community to assist others facing similar challenges.
If you find our response helpful, we kindly request you to mark it as the accepted solution and provide kudos. This will assist other community members encountering similar queries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @BeaBF and @ZhangKun for your response.
We appreciate your inquiry through the Microsoft Fabric Community Forum.
To successfully import multiple Power Query (.pq) files into Power BI Desktop as separate queries, please follow the steps outlined below as a potential solution:
- Launch Power BI Desktop. Navigate to the Home tab and select Transform Data to open the Power Query Editor. In the Power Query Editor, click on Home > Advanced Editor.
- Open each .pq file using a text editor such as Notepad or Visual Studio Code. Modify the .pq files by removing the section or shared declarations. Copy the M code content from the .pq file.
- In the Power Query Editor, create a new blank query by selecting Home > New Source > Blank Query. In the new query, go to Home > Advanced Editor and paste the copied M code into the Advanced Editor.
- Ensure that each query has a unique name. The queries can be renamed in the Queries pane after their creation.
- Repeat the above steps for the remaining .pq files.
Additionally, if you find our response helpful, kindly mark it as the accepted solution and provide kudos. This will assist other community members encountering similar queries.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much.
There is no powerShell or different language to automate process?
Best,
Jacek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when you use a custom connector, you reference the contents of the connector. Because of this behavior, it is different from pasting code.
If you use Power Query in Excel, you can add code using VBA, VSTO..., but it may be difficult or impossible to do it in PowerBI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
thanks!
Why this is making difference what kind of M code i have?
let
Source = #table({"Name", "Age"}, {
{"Alice", 25},
{"Bob", 30},
{"Charlie", 35}
})
in
Source
example 2:
let
Source = #table({"Product", "Price"}, {
{"Laptop", 1000},
{"Phone", 600},
{"Tablet", 400}
}),
AddedColumn = Table.AddColumn(Source, "Discounted Price", each [Price] * 0.9)
in
AddedColumn
Mez file:
section Section1;
shared MyQuery =
let
Source = #table({"Product", "Price"}, {
{"Laptop", 1000},
{"Phone", 600},
{"Tablet", 400}
}),
AddedColumn = Table.AddColumn(Source, "Discounted Price", each [Price] * 0.9)
in
AddedColumn;
Best,
Jacek

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
06-26-2024 11:51 PM | |||
05-08-2024 02:47 AM | |||
05-12-2024 10:05 PM | |||
06-05-2023 05:09 AM | |||
04-20-2024 06:08 AM |
User | Count |
---|---|
25 | |
24 | |
18 | |
17 | |
15 |