Microsoft Power Query is a free add-in for Excel – Part of PowerBI that provides self-service Business Intelligence features. Let’s see how to extract SharePoint list data using Power Query for Excel.
Step 1: Download & Install Power Query Add-in
To start with, Download the Power Query Add-in for Excel from: https://www.microsoft.com/en-us/download/details.aspx?id=39379
Once installed, You’ll find a new tab “Power Query” tab added to Microsoft Excel.
Step 2: Connect to SharePoint List
To extract SharePoint list data, click on the “From Other Sources” button from the ribbon and choose “From SharePoint List”
Provide the URL of your SharePoint site and choose the Authentication method accordingly – I Selected Windows. For Office 365, choose organizational credentials.
Once you are successfully logged in, You’ll get the Navigator page to choose your source list and click on “Load”. By default, Only Lists appear in the Navigator. Pick any list and use “Advanced Editor”, change List name & “SharePoint.Tables” to “SharePoint.Contents” to get data from any library!
Step 3: Remove Unnecessary columns, Perform ETL
This loads all columns from the SharePoint list. However, we may not be interested in fetching all columns, and also removing columns that are not required speeds up our data retrieval. So, Right-click on the Query from the Right side pane, Choose Edit.
You’ll get a Power Query Editor window where you can:
- Add remove columns to your query – in order to focus only on what we need
- Merge-Append (Join-Union) from other lists
- Perform ETL operations such as replace values, Split Columns, Group by etc.
To remove unnecessary columns, click on the “Choose Columns” button and select only the columns you need. Once done, click on the “Load & Close” button from the ribbon. All activities inside the query editor are recorded as steps, and we can remove/Re-order them as required.
To get actual values of Lookup columns, You’ll have to “Expand” them. Once ready, click “Close and Load” from the Query Editor ribbon, and the list data will load to your workbook,
Although “Export to Excel” can retrieve data from the SharePoint list, Power Query has much more capabilities.
So next time, without the need to open the SharePoint site in the browser, You can just open the Excel file and hit refresh! Once the data is loaded, We can utilize advanced features such as Pivot Table, Pivot Chart, etc., to output a variety of visual data in an Excel worksheet.
I used this Power Query tool with SharePoint 2010 and SharePoint 2013.