Automating Power Query

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,080
If you use Power Query to clean some data, can these steps be automated? For example, in Excel, I can click on the macro recorder, do something, then stop and see the something I did written in vba. Is there something equivalent in Power Query?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,147
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
The steps you take in PQ are automatically added to the query, so I'm not sure I understand your question.
 

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,080
The steps you take in PQ are automatically added to the query, so I'm not sure I understand your question.


In Excel, if I clicked on the macro recorder button, then typed in the value of 1 into cell A1, then stopped the recorder, I can see the code automatically generated.

So instead of typing in the value of 1 into cell A1 but I did some manipulating of data using power query such as these steps:

Click on Power Query option at the top
Click get data from web
Paste in a URL
Click OK to load the data

such as in this video:

Code:
https://www.wiseowl.co.uk/power-bi/videos/powerpivot/power-query/
does the vba show these steps?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,147
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
No it wouldn't. The steps are saved in the M code in power query. If you want to automate creating a new query, you can do that if you have a version that supports it, by using the Workbook.Queries.Add method (see for example here).
 

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,080
No it wouldn't. The steps are saved in the M code in power query. If you want to automate creating a new query, you can do that if you have a version that supports it, by using the Workbook.Queries.Add method (see for example here).
Thanks, that's what I'm after.
 

Forum statistics

Threads
1,077,778
Messages
5,336,249
Members
399,072
Latest member
abublitz

Some videos you may like

This Week's Hot Topics

Top