Power Query: Keeping it Current – Part 1
6 July 2022
Welcome to our Power Query blog. This week, I copy a query to the workbook data has been extracted from.
In Power Query: Sheets Ahead – Part 1, I uploaded data from multiple sheets into another workbook. I had some simple monthly data:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image1-1656933003.png/39869967246118ba3ca0b95136ffedca.jpg)
This sheet is for January; I had a similar sheet in the same workbook for February:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image2-1656933035.png/49bbd77fa742a7a3f29634a6d68f2dee.jpg)
I created a query that not only concatenated this data, but also included the sheets for other months as they appeared if I refreshed it. This query was in a separate workbook:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image3-1656933063.png/d183256424fe9831bbb3d59353a78c2e.jpg)
The query created a Table in the separate workbook:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image4-1656933092.png/869ed243e517f79d540b674493d3136b.jpg)
However, what if I needed to create this Table in the original workbook?
I want to demonstrate the differences and the challenges when I move from concatenating data in an external workbook to the current workbook. I start by taking a copy of Monthly Sales. There are several ways I can do this, as I described in Power Query: It’s Good to Share (a Query). I choose to right-click on my query and ‘Copy’:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image5-1656933405.png/7a826c15edd0bd1e1ebae56ff612d4c3.jpg)
Then, I open the workbook containing the original data.
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image6-1656933433.png/413b3b2371b36fdbdef50fed3f860705.jpg)
It currently has no queries as I can see if I use the ‘Queries & Connections’ button on the Data tab. If I right-click in the ‘Queries & Connections’ pane, I have a paste option:
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image7-1656933456.png/20e9243cfc0254cec03ea0e7703be2d9.jpg)
When I paste my query, the results don’t look good!
![](http://sumproduct-4634.kxcdn.com/img/containers/main/./image8-1656933484.png/5cf7f3bc471af1e203b61fed5d246ca7.jpg)
The message is telling me the query can’t access the workbook because I have it open. This is true since it is this workbook. However, I have the M code, and I can change it to work with my current workbook. I will be doing this next time.
Come back next time for more ways to use Power Query!