As Excel Analysts, we’re often asked to pull data from various sources. One of these sources for many of us is SSRS. SSRS (SQL Server Reporting Services).
If you’ve pulled data from SSRS before, you’ll know that it’s a bit of a pain.
You’ve got to go to a URL, use the dropdowns on the SSRS interface to make parameter selections, wait for the report to refresh, export to Excel, then copy and paste the data into your data model.
Here is a screenshot of an SSRS Report.
Well today, I’d like to show you a way to leverage PowerPivot to automatically pull SSRS data directly into Excel.
Step 1: Run the SSRS Report and Get and ATOM file
So the first thing you’ll need to do is go to the SSRS report, select your desired parameters, and run it.
After it runs, instead of selecting the Export to Excel, choose the Export Data Feed option.
This option allows you export an ATOM Service file.
An Atom Service file is basically a text file that has XML markup defining how to connect and interact with a data source.
When you save an ATOM file, you’ll notice it has the extension of atomsvc.
The name of the file will typically be the name of the SSRS report you pulled it from. You can change the name if you want.
The file itself contains no data. It simply holds the connection parameters you selected when you ran the report.
This file can be used by PowerPivot as a kind of proxy to connect to SSRS and pull the data defined by the parameters.
Step 2: Use PowerPivot to Connect through the ATOM file.
Now that you have an ATOM file, you can open a fresh Excel workbook.
On the PowerPivot tab, click the Manage button.
This opens the PowerPivot window.
Now click on the From Other Sources option to activate the Table Import Wizard.
Select the Other Feeds option.
Browse to the ATOM file you saved, then click NEXT.
You can give the data feed a friendly name. In this example, I called my feed LineItemDataFeed.
After you click finish, PowerPivot will start retrieving the data.
After you get a status of Success, you can close the Table Import Wizard.
You should now see the data in the PowerPivot window.
You’ll notice that the first few columns of the data feed are not real data. They are the parameters for the data.
That is to say, they simply show the parameters you selected when first running the SSRS report.
Keeping these columns may be useful to you, but I typically get rid of them.
Here’s how to remove the parameter columns.
On the Design tab of the PowerPivot window, click the Table Properties command.
This will open the Edit Table Properties dialog box.
Here, you can simply uncheck the columns you don’t want to see in the data feed.
After you’ve completed unchecking the columns, click Save.
Step 3: Link the PowerPivot data to an Excel worksheet.
Now that PowerPivot contains the data from the desired SSRS report, you can now show that data on an Excel Worksheet.
This step involves nothing more than linking the PowerPivot data to a sheet.
First, you can close the PowerPivot Window, and switch to the Excel window.
Now, go to the Data tab in Excel and click the Existing Connections command.
In the Existing Connections dialog box, choose Connections in this Workbook and double-click your target data feed.
Choose to Import Data as a Table and click the OK button.
Step 4: Test/Refresh.
At this point, you’ll have all the SSRS data on a worksheet.
You can now right-click anywhere in the table and click Refresh to get the latest data from SSRS!
Notes
1. If you don’t have PowerPivot available to you, you can actually use Excel’s built in Get External Data feature. Simply click Data->From Other Sources->From OData Data Feed, then point to the ATOM file you saved in Step 1. That being said, I personally like using PowerPivot so the data I pull can be incorporated with other data in my data model.
2. You can actually edit the parameter values within the ATOM file to get different data. For example, if you ATOM file contains a parameter for year, changing the value from 2016 to 2017 will actually get you different data. Soooo….you can save one ATOM file, make a copy, and change the parameter values to get different data sets.
3. If the URL for your SSRS report is moved or changes, you’ll need to edit the ATOM file to point to the new URL, or more simply, save a fresh ATOM file from SSRS.
4. Interestingly, PowerQuery doesn’t allow you to point to ATOM files on your PC to get data, so this trick does not work with PowerQuery. I’m sure there is a way to hit SSRS data from PowerQuery, but I haven’t found it yet.