I am looking to transfer power queries from one workbook to another with VBA. I know how to do this manually but it is very cumbersome.
A power query can be accessed via the Workbook.Connections object. I am currently attempting to port the queries over with a VBA function or Sub.
The manual process is as follows
- for each query in workbook 1
- open up workbook 1 and go to advanced editor - copy into a text editor
- open up workbook 2 create query, and paste text into advanced editor
- ensure source tables are the same - and run query to validate
I was able to solve it by using the Workbook.Query object.
here is my solution.