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
jaryszek
Memorable Member
Memorable Member

Using Power Query SDK

hi Guys,

1. I have a multiple connectors as *.pq files and want to import them into power bi desktop automatically (not manually one by one) and use in power bi service.
I want to use cloud data, not my personal gateway. 
How to make this? 

2. How to create parameters for connector and dynamically change them after importing connector using rest api for changing parameters? https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-parameters
this is a call for changing parameters. 

Thank you for help,
Best
Jacek

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jaryszek,

 

It means that Power BI Desktop does not provide a built-in API to programmatically insert or modify Power Query (.m) code inside a ".pbix" file, but using Power BI Templates (.pbit) allows you to store queries separately from data, making it easier to manage and reuse them across reports.

To integrate .pq files into a development pipeline, you can:

* Merge .pq files into a single .m script and store it in version control (e.g., Git, Azure DevOps).

* Use a ".pbit" template containing predefined queries to create reports dynamically.

* Then use PowerShell or Power BI REST API to create ".pbux" reports dynamically from the

   template.

* Once the ".pbix" file is created, you can publish it automatically using the Power BI REST API or

   PowerShell.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

 

View solution in original post

13 REPLIES 13
Anonymous
Not applicable

Hi @jaryszek,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

Anonymous
Not applicable

Hi @jaryszek,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily.


Thank you.

Hello,

sorry but problem is not solved. 

Anonymous
Not applicable

Hi @jaryszek,

Could you please tell me what and where exactly you are facing an issue with or is the issue mentioned in original question still persist? 

 

Thank you

With pleasure:

"Power BI Desktop does not have native APIs for direct .m code injection. But, after merging the files into a single .m script, we can use Power BI Template Files (.pbit) which store queries separately from data." 
What does it mean? How can i use pqfiles with development pipeline?

Best,
Jacek

Anonymous
Not applicable

Hi @jaryszek,

 

It means that Power BI Desktop does not provide a built-in API to programmatically insert or modify Power Query (.m) code inside a ".pbix" file, but using Power BI Templates (.pbit) allows you to store queries separately from data, making it easier to manage and reuse them across reports.

To integrate .pq files into a development pipeline, you can:

* Merge .pq files into a single .m script and store it in version control (e.g., Git, Azure DevOps).

* Use a ".pbit" template containing predefined queries to create reports dynamically.

* Then use PowerShell or Power BI REST API to create ".pbux" reports dynamically from the

   template.

* Once the ".pbix" file is created, you can publish it automatically using the Power BI REST API or

   PowerShell.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

 

Anonymous
Not applicable

Hi @jaryszek,

As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.

If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.


If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.

Anonymous
Not applicable

Hi @jaryszek,

Thanks for reaching out to the Microsoft fabric community forum.

 

It looks like you want to automate the import of multiple ".pq" Files into Power BI Desktop & Service. You can merge all .pq files into a single .m script automatically using powershell. As for creating parameters & dynamically changing them, you can add new parameters and update them using REST API.

 

I would also take a moment to thank @lbendlin, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

Thank you.

Before I close the topic: 
"You can merge all .pq files into a single .m script automatically using powershell."

How after merging code using powershell put it into power BI Desktop? Do you have any code examples?

Best,
Jacek

Anonymous
Not applicable

Hi @jaryszek,

Power BI Desktop does not have native APIs for direct .m code injection. But, after merging the files into a single .m script, we can use Power BI Template Files (.pbit) which store queries separately from data.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

 

thank you. 

If i would have template file, can i use it for building pwoer bi reports with queries sitting there? 

Best Wishes,
Jacek


Anonymous
Not applicable

Hi @jaryszek,

Yes, you can use a Power BI Template to build new reports while keeping the queries intact.

 

Thank you.

lbendlin
Super User
Super User

Custom connectors mandate the use of a gateway, either personal or standard/enterprise.  Even if they connect to cloud sources.

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.