One of the cool features in Excel 2013’s Power Query is being able to load to the Data Model (PowerPivot) directly. But Excel 2010 doesn’t appear to have this feature. Interestingly, you can still load Power Query directly to Power Pivot in Excel 2010, it just takes a bit of a careful workaround.
Let’s look at the required steps
Step 1: Create Your Connection
First, I’m going to load in the content of a text file. So I:
- Go to Power Query –> From File –> From Text
- I browsed to the file I needed, and imported it into Power Query
- I do whatever cleanup is needed and name the query Sales
- Next, we go to the Home tab –> Close and Load –> Close and Load To…
And here’s the important part:
- Choose “Only Create Connection” –> Load
And I’ve now got a basic connection to my sales table without landing it in a worksheet:
Step 2: Grab the Connection String
Now, here comes the secret. We need to get the connection string that Excel uses to connect to the Power Query. Here’s how:
- Go to the Data tab –> Connections
In there, you’ll see the name of your new connection:
- Select your Query and click Properties
- Click the Definition tab
Now you’ll be looking at something like this:
Notice that this query is actually an OLE DB Query that is simply “SELECT * FROM [Sales]” That seems easy to work with. But the key for us is the connection string shown (#2 in the image above).
- Select the ENTIRE connection string
- Press CTRL + C to copy it
- Click Cancel
Note: Make sure you start at “Provider=” and highlight all the way to the end. (It’s much longer than what you see in that little box.)
Load Power Query directly to Power Pivot
Finally, we’re going to pull this into Power Pivot. To do this:
- Go to the Power Pivot tab –> PowerPivot Window
- From Other Sources –> Others (OLEDB/ODBC) –> Next
- Name your table
- Paste your Connection String in the box
- Click Next –> Next –> Finish –> Close
And voila! We have our Power Query linked directly into Power Pivot in Excel 2010!
Just remember… if you do this, NEVER modify this table in Power Pivot. Always go back to modify the table in the Power Query stage. Failure to do so could set the table into a non-refreshable state.
The post Load Power Query directly to Power Pivot in Excel 2010 appeared first on The Ken Puls (Excelguru) Blog.