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

Merge all *.pg files into one .m script using powershell

Hi Guys,

i want to take all my .pq files and merge them into one .m script using powershell.

Maybe do you have a sample code to do this? 

After merging i can use it within my template power bi file...
Best,
Jacek

2 REPLIES 2
amitchandak
Super User
Super User

@jaryszek , In power query, you can copy paste code into power query

or Save the files in pbip/b format and then you can use code to merge the folder data where you have power query code.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks i do not want to copy and paste them manually, this why i created this post. 

I want to move all my *.pq files into power bi desktop report automatically. 

Thanks for help,
Jacek

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.