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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
scottdk
Frequent Visitor

Manage Excel Power Query Groups when importing queries with a script.

Is there a way I can programatically manage which groups that queries reside under? I can't find any reference in Excel VBA to the Power Query Object Model.

 

Inspired by EditExcelPQM, I wrote VBA scripts inside my spreadsheets to import and export  Queries, so I can do all my editing and source control in VSCode. When I import new scripts or reimport existing scripts, they all land in the "Other Queries" folder. 

(Aside from when doing deep debugging with the full scripts, my queries in Power Query simply load the .pq script files and add them as functions using Expression.Evaluate. That way all source code is external to the Excel file, and only functions I have explicitly invoked will return data to excel. This seems to speed excel up immensely, as Excel isn't constantly refreshing intermediate queries.)

 

scottdk_2-1718876780753.png

 

 

 

 

 

1 REPLY 1
Anonymous
Not applicable

Hi @scottdk ,

 

Thank you for sharing your findings and tips.
I have attempted to identify a solution for managing query grouping from the VBA documentation and some of the standard tripartite tools, but have been unable to find a suitable solution. It is possible that no such interface is provided.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.