Using Excel With External Data – What’s the Right Tool?

Excel has been used with external data for… well, as long as I’ve been using Excel. So why would anyone bother to write a blog post about this given that the capability is so mature? In recent years, Excel has adopted a number of new, and frankly better mechanisms for working with external data, while retaining the old. Given that there are now multiple tools in Excel for working with external data, it’s not always clear as to which one is the best, and unfortunately there is no single tool that wins over all, although I believe that that will be the case soon.

The answer, as always is, “it depends”. When it depends, the important thing is to understand the strengths and weaknesses of each approach. With that said, let’s have a look at all of the options.

ODC Connections

ODC (Office Data Connections) are the traditional method of accessing data in Excel. You can create or reuse an ODC connection from the Data tab in the Excel ribbon.

When using an ODC connection, you establish a connection with a data source, form some sort of query and import the resultant data directly into the Excel workbook. From there, the data can be manipulated and shaped in order to support whatever the end user is trying to do. The one exception to this behaviour is the connection to SQL Server Analysis Services (SSAS). When a connection is made to SSAS, only the connection is created. No data is returned until an analysis is performed (through a pivot table, chart etc), and then only the query results are retrieved.

When the workbook using an ODC connection is saved, the data is saved within it. In the case of an SSAS connected workbook, the results of the last analysis are saved along with it. For small amounts of data, this is just fine, but any large analysis is bound to quickly run into the data limits in Excel which is 1,048,576 rows by 16,384 columns in Excel 2013. In addition such a file is very large and extremely cumbersome to work with, but even as such, Excel has been the primary tool of choice for business analysts for years.

Data loaded into the workbook can be refreshed on demand, but it can also be altered, shaped, mashed up, and as is too often the case, grow stale. Workbooks such as these have become known as “spreadmarts” and are the scourge of IT and business alike. With these spreadmarts, we have multiple versions of the same data being proliferated, and it becomes harder to discern which data is most accurate/current, not to mention the governance implications.

SharePoint has provided a way to mitigate some of the concerns with these connections. SharePoint itself supports ODC connections, and therefore users can access these workbooks stored within SharePoint and it also allows them to refresh data from the source either on demand or on open. A single point of storage along with a measure of oversight and browser access helps to restore a modicum of sanity to an out of control spreadmart environment, but the core issues remain.

In order to help with the core issues, Microsoft introduced PowerPivot in 2009.

PowerPivot Connections

Created in PowerPivot

PowerPivot was originally (and still is) an add-in to Excel 2010, and is a built in add-in to Excel 2013. PowerPivot allows for the analysis of massive amounts of data within Excel, limited only by the memory available to the user’s machine (assuming a 64 bit version). It does this by highly compressing data in memory using columnar compression. The end result is that literally hundreds of millions of rows of data can be analyzed efficiently from within Excel.

You can see that compression at work by comparing the same data imported into an Excel workbook directly, and into a PowerPivot model with a workbook. The following two files contain election data, and represent the maximum number of rows that Excel can handle directly (1,048,576) and 25 columns.

Getting data into the model was originally (and still can be) a completely separate process from bringing it into Excel. PowerPivot has its own data import mechanism, accessed from the Power Pivot window itself. First, click on the PowerPivot tab in Excel and then click manage. If you don’t have a PowerPivot tab, you will need to enable the add-in. If you don’t have the add-in, you have an earlier version of Excel – you’ll need to download it.

Once the PowerPivot window opens, the “Get External Data” option is on the ribbon.

Once the appropriate data source is selected and configured, data will be loaded directly into the data model – there is no option to import that data into a worksheet. Once the data is in, pivot tables and pivot charts can be added to the workbook that connect to the data model much like when creating an ODC connection to Analysis Services. In fact, it’s pretty much exactly like connecting to Analysis services, except that the AS process is running on the workstation.

Created in Excel

PowerPivot, and more importantly the tabular data model was included in Excel 2013. With that addition, Microsoft added a few features to make the process of getting data into the data model a little easier for users that were a little less tech savvy, and may be uncomfortable working with a separate PowerPivot window. That’s actually part of the thinking in leaving the PowerPivot add-on turned off by default.

When a user creates an ODC connection as outlined above, there are a couple of new options in Excel 2013. First, the “Select Table” dialog has a new checkbox – “Enable selection of multiple tables”.

When this option is selected, more than one table from the data source can be selected simultaneously, but more importantly, the data will automatically be sent to the data model in addition to any other import destinations.

Even if the multiple selection option wasn’t chosen, the next dialog in the import process, “Import Data” also has a new check box – “Add this data to the Data Model”.

Its purpose is pretty self-explanatory. It should be noted that if you choose this option, and also choose “Only Create Connection”, the data will ONLY be added to the model, nowhere else in the workbook. This is functionally equivalent to doing the import from the PowerPivot window, without enabling the add-in.

Power Query Connections

When Power BI was originally announced, Power Query was also announced and included as a component. This was very much a marketing distinction, as Power Query exists in its own right, and does not require a Power BI license to use. It is available as an add-on to both Excel 2010 and 2013, and will be included with Excel 2016.

Power Query brings some Extract, Transform and Load (ETL) muscle to the Excel data acquisition story. Data can be not only imported and filtered, but also transformed with Power Query and its powerful M language. Power Query brings many features to the table, but this article is focused on its use as a data acquisition tool.

To use Power Query, it must first be downloaded and installed. Once installed, it is available from the Power Query tab (Excel 2010 and 2013).

Or from the data tab, New Query (Excel 2016)

Once the desired data source is selected, the query can be edited, or loaded into either the workbook, the data model, or both simultaneously. To load without editing the query, the load option at the bottom of the import dialog is selected.

Selecting “Load To” will allow you to select the destination for the data – the workbook, the model or both. Selecting Load will import the data to the default destination, which is by default the workbook. Given the fact that the workbook is an inefficient destination for data, I always recommend that you change their default settings for Power Query.

To do so, select Options from the Power Query tab (2010 and 2013) or the New Query button (2016), click the Data Load section, and then specify your default settings.

Data Refresh Options

In almost every case when external data is analyzed, it will need to be refreshed on a periodic basis. Within the Excel Client, this is simple enough – click on the data tab, and then the Refresh All button, or refresh a specific connection. This works no matter what method was used to import the data in the first place. Excel data connections can also be configured to refresh automatically every time the workbook is opened, or on a periodic basis in the background.

However, workbooks can also be used in a browser through Office Web Apps and Excel Services (SharePoint and Office 365) or as a data source for Power BI dashboards. In these cases the workbooks need to be refreshed automatically in order that the consuming users will see the most up to data when the workbooks are opened. The tricky part is that not all of the connection types listed above are supported by all of the servers or services. Let’s dive in to what works with what.

SharePoint with Excel Services

Excel Services first shipped with SharePoint 2007, is a part of 2007, 2010, and will be included with 2016. From the beginning, Excel Services allowed browser users to view and interact with Excel workbooks, including workbooks that were connected to back end data. The connection type supported by Excel Services is ODC, and ODC only.

Excel Services has no mechanism for maintaining data refresh. However, the data connection refresh options are supported which means that the workbook can be automatically refreshed when opened, or on a scheduled basis (every xxx minutes in the background). Unfortunately, this can come with a significant performance penalty, and once refreshed it is only in memory. The workbook in the library is not updated. The data in the workbook can only be changed by editing the workbook in the client, refreshing it, and re-saving it

Workbooks with embedded data models (PowerPivot) can be opened in the browser, but any attempt to interact with the model (selecting a filter, slicer, etc) will result in an error unless PowerPivot for SharePoint has been configured.

SharePoint with Excel Services and PowerPivot for SharePoint

PowerPivot for SharePoint is a combination of a SharePoint Service application and Analysis Services SharePoint mode. When installed, it allows workbooks that have embedded PowerPivot data models to be interacted with through a browser. The way that it works is that when such a workbook is initially interacted, the embedded model is automatically “promoted” to the Analysis Services instance, and a connection is made with it, thus allowing the consuming user to work with it in the same manner as with a SSAS connected workbook,

The PowerPivot for SharePoint service application runs on a SharePoint server and allows for individual workbooks to be automatically refreshed on a scheduled basis. The schedule can be no more granular than once per day, but the actual data within the model on disk is updated, along with any Excel visualizations connected to it.

When the refresh process runs, it is the functional equivalent of editing the file in the client, selecting refresh all, and saving it back to the library. However, there is one significant difference. The Excel client will refresh all connection types, but the PowerPivot for SharePoint process does not understand Power Query connections. It can only handle those created through the Excel or PowerPivot interfaces.

Power Pivot for SharePoint ships on SQL Server media, and this limitation is still true as of SQL Server 2014. At the Ignite 2015 conference in Chicago, one of the promised enhancements was Power Query support in the SharePoint 2016 timeframe.

Office 365

Office 365, or more precisely, SharePoint Online supports Excel workbooks with ODC connections and PowerPivot embedded models in a browser. These workbooks can even be refreshed if the data source is online (SQL Azure), but they cannot be refreshed automatically. In addition, only ODC and PowerPivot connections are supported for manual refresh. Power Query connections require Power BI for Office 365. In addition, Office 365 imposes a 30 MB model size limit – beyond that, the Excel client must be used. In short, the Office 365 data refresh options are very limited.

Power BI for Office 365

Power BI for Office brings the ability to automatically refresh workbooks with embedded data models. Data sources can be on premises or in the cloud. On premises refresh is achieved through the use of the Data Management Gateway. It also raises Office 365’s model size limit from 30 MB to 250 MB. With Power BI for Office 365 both manual and automatic refreshes can be performed for both PowerPivot and Power Query connections, however Power Pivot connections are currently restricted to SQL Server and Oracle only.

The automatic refresh of ODC connections is not supported. A workbook must contain a data model in order to be enabled for Power BI.

Power BI Dashboards

Power BI Dashboards is a new service, allowing users to design dashboards without necessarily having Office 365 or even Excel. It is currently in preview form, so anything said here is subject to change. It is fundamentally based on the data model and it works with Excel files as a data source currently, and it is promised to use Excel as a report source as well. The service has the ability to automatically refresh the underlying Excel files on a periodic basis more frequent than daily.

In order for a workbook to be refreshed by Power BI, it must (at present) be stored in a OneDrive or OneDrive for Business container. It also must utilize either a PowerPivot, or a Power Query connection. At present, the data source must also be cloud based (ie SQL Azure) but on premises connectivity has been promised.

SQL Server Analysis Services

Another consideration, while not a platform for workbooks is SQL Server Analysis Services (SSAS). Excel can be used to design and build a data model, and that data model can at any time be imported into SSAS. As of version 2014, SSAS fully supports all connection types for import – ODC, PowerPivot and Power Query. Once a data model has been imported into SSAS, it can be refreshed on a schedule as often as desired, and you can connect to it with Excel, and share it in SharePoint. You can also connect to it in Power BI Dashboards through the SSAS connector. From both a flexibility and power standpoint, this is the best option, but it does require additional resources and complexity.

Refresh Compatibility Summary

For convenience, the table below summarizes the refresh options for the different connection types.

 

ODC

PowerPivot

Power Query

Excel Client

M

M

M

SharePoint/Excel Services

M

SharePoint/Excel Services/PP4SP

M

A

SQL Server Analysis Services Import

A

A

A

Office 365

M

M

Office 365 with Power BI

A*

A

Power BI Dashboards

A

A

M – Manual refresh

A – Both Manual and Automatic Refresh

* only limited data sources

 

The Right Tool

I started out above by saying that the selection of import tool would depend on circumstances, and that is certainly true. However, based on the capabilities and the restrictions of each, I believe that a few rules of thumb can be derived. As always, these will change over time as technology evolves.

  1. Always use the internal Data Model (PowerPivot) when importing data for analysis.

     

  2. Power Query is the future – use it wherever possible

    All of Microsoft’s energies around ETL and data import are going into Power Query. Power Query is core to Power BI, and announcements at the Ignite Conference indicate that Power Query is being added to both SQL Server Integration Services and to SQL Server Reporting Services. Keep in mind that we have been discussing only the data retrieval side of Power Query – it has a full set of ETL capabilities as well, which should also be considered.

  3. PowerPivot or ODC Connections must be used on premises

    PowerPivot for SharePoint does not support Power Query for refresh. This means that you MUST use PowerPivot connections for workbooks with embedded models. If you are already using SSAS, use an ODC connection within Excel.

  4. Power Query or PowerPivot must be used for cloud BI.

    PowerPivot connections will work for a few limited cases, but more Power Query support is being added constantly. Where possible, invest in Power Query

  5. If on-premises, consider importing your models into SSAS

    SSAS already supports Power Query. If, instead of using PowerPivot for SharePoint, Analysts build their models using Excel and Power Query, they can be “promoted” into SSAS. All that is then required is to connect a new workbook to the SSAS server with an ODC connection for end users. The Power Query workbooks can be used in the cloud, and the SSAS connector in Power BI Dashboard can directly use the SSAS models created.

  6. Choose wisely. Changing the connection type often requires rebuilding the data model, which in many cases is no small feat.

In summary, when importing data into Excel, the preferred destination is the tabular model, and to import data into that model, Power Query is the preferred choice. The only exception to this is on premises deployments. In these environments, consideration should be given to connecting to a SSAS server, and failing that, PowerPivot imports are the best option.

17 thoughts on “Using Excel With External Data – What’s the Right Tool?

  1. Rayis Imayev

    Hi John,
    Thank you for the article.
    I was able to create an ODC connection and published it to SharePoint trusted connection library. Then I can access this publish ODC from the Excel and bring data into the file or even add it to a PowerPivot data model. However in PowerPivot model, this ODC connection gets transformed to the actual database connection based on the metadata from the published ODC connection file. When I try to browse and select the very same published ODC connection file in PowerPivot UI it gives me an error that ‘file is not found’.

    Is it possible for a PowerPivot model directly source an ODC connection file and not though it’s upper Excel layer? And does SSAS tabular support an ODC connection as a source?

    Thank you for your help.

  2. John White Post author

    Hi Rayis

    Good question. No- PowerPivot won’t use an ODC connection – they are separate entities. I was going to point out the differences in the article, but it was getting long enough already. PowerPivot uses its own “internal” connection, but you can configure connection properties for refresh.

    he same is true for SSAS when the model is imported from the workbook.

  3. Ronald Vendel

    Hello John,

    Great!!! article. This makes all so much clearer..
    I almost gave up in trying to make a “get data + refresh online”, based on a XLS+PowerQuery in an SP/365 environment running..
    Now, with your explanation of correlations and dependencies (restrictions) above, I start to see the light again 🙂
    Your extensive re-search on the various scenario’s are so welcome and really make the difference..
    Many!! thanks,
    Ronald

  4. Rayis Imayev

    Thank you John,
    yes, I knew that all those PowerPivot data connections settings could be changed manually.
    I was more looking into a Excel PowerPivot change without “prompting” or “waking” it up into memory.

    Well, perhaps there will be some public API available for this in future…

  5. Chris Floyd

    Great Article,

    In addition to the options above you may use a thirdparty tool: Power Update from Power-Planner.com. There is a completely free version that enables full feature set for one workbook. If you want to add more workbooks there is a small fee. The main reason to use Power Update is that it makes Power Query updates fully automated.

    You can download the free version from here:

    http://www.power-planner.com/Portals/0/Downloads/PowerUpdateSetup_x64.msi
    http://www.power-planner.com/Portals/0/Downloads/PowerUpdateSetup_x86.msi

    Website is here:
    http://www.power-planner.com/Products/ProdID/10/Power_Update

    Chris

  6. Pingback: Connecting to Analysis Services From Power BI Website, Power BI Designer, and Excel (Part 4) - SQL Server - SQL Server - Toad World

  7. Pingback: Connecting to Analysis Services From Power BI Website, Power BI Designer, and Excel (Part 4) | Geek Programmers

  8. Peejay Lal

    Hi John, I am a 70-year-old trader of stock options. I know Excel well and use Excel to produce
    analytics. After spending some time, I have been able to set up DDE link with my broker’s API following their naming convention and incorporating in my spreadsheet to pull live data. I
    have to do some manual inputting too. The spreadsheet contains all formula and macros to
    produce for me analytics of limited visual appeal.

    Instead of me using my desktop Excel to input manual data can I use Smartphone to do that job?
    Since desktop and Smartphone can’t communicate with each other I guess I will have to go for
    a Cloud solution. Does cloud version of Office 365 has a full-fledged Pivot programme to interact with Smartphone via a browser?

    I will be grateful if you can guide me for such a solution as I have developed back pain and find
    it tiresome in using Desktop or laptop .

  9. kurt

    Hello

    some question on your point
    “5.If on-premises, consider importing your models into SSAS SSAS already supports Power Query. If, instead of using PowerPivot for SharePoint, Analysts build their models using Excel and Power Query, they can be “promoted” into SSAS. All that is then required is to connect a new workbook to the SSAS server with an ODC connection for end users. The Power Query workbooks can be used in the cloud, and the SSAS connector in Power BI Dashboard can directly use the SSAS models created”

    ==> Any idea if this will be possible in the near future , so “publishing a powpivot model that uses Power query, into SSAS Tabular” ?

    I do not seem to find any info on this…maybe someone else heard something about it ?

    tx
    Kurt

  10. Torstein Dahle

    Hi John.

    I was wondering if you have any thoughts about the lacking of a good replacement for MS Query which have been around since Office 97.

    We have been using MS Query for (too) many years and the end-users love it because of the simplicity.

    What makes MS Query special is the wizard that gives the end-user the chance og select their data BEFORE executing the query. Furthermore there is the strength of the DSN-connection that you can use parameters to make the the Excel-reports more dynamic.

    When using these new tools you refer to, the strategy is normally to start with a complete set of data and afterwards do the filtering in Excel. This is ot a great way to work if the full dataset is a big one.

    Have you come by any stand-alone tools or Excel addins that can be a good replacement for MS Query, Personally I find i strange that Microsoft has done not a thing to brush it up. It still looks the same, but it still works and is still available in Excel 2013.

    Any comments ?

    Regards Torstein

  11. Gabriel M.

    Hi John,
    thanks a lot for sharing this article. I’m trying to figure out if it is possible to refresh an Excel Workbook, saved on OneDrive (using Office 365), connected to an SSAS Tabular instance (PaaS in Azure). Have you ever tried to do it?
    Thank you.
    Gabriel

  12. John White Post author

    Hey Gabriel

    That should be possible – however, I haven’t yet tried it. You should be able to do it manually through Office Online, and automatically by connecting it to Power BI. Given that the connection is a cloud data source, it shouldn’t require a Pro license either. Hope this helps – I’d be interested to see how you make out.

  13. Bob O'Shea

    John, great article!

    I have built an elaborate Excel/SharePoint system as a pilot for an enterprise system. I have a few questions:

    1. Have you found a way to query the data model in one Powerpivot file from another Excel file? I’ve been forced to either add data to both the model and a table or create a pivot from the model in order to expose the data to a external query.
    2. Any word from MS when Power Query will be refreshable on SharePoint 2016 (on premise)?
    3. If the outlook is bleak, I like your SSAS approach (which was my upgrade path to the enterprise anyway) BUT does the ETL in SSAS respect data import from Excel files in SharePoint? I still want to have my users fill out simple Excel (vs. web) forms and place them in a folder. Can the SSAS ETL (originally my power query) reach into Sharepoint folders and grab the data? If so, will the paths I have in my Power Queries (\\server\folder\file) work directly or do I have to modify them in SSAS?

    Thanks again for your great article and experience with these tools.

    Bob

  14. John White Post author

    Thanks Bob!

    1 – You should be able to do this, but you’ll need to use PowerPivot for SharePoint. The PowerPivot Gallery will have a button to do precisely this.
    2 – “Real soon now”. Honestly, I don’t expect to see this until mid-2017 at the earliest. That’s me guessing – I don’t have more insight as to when.
    3 – Yes – you can use SSIS to get data from an Excel file in a SharePoint library. You’ll need to use the UNC naming convention. I actually have a very old post on this here – https://whitepages.unlimitedviz.com/2010/12/unc-path-naming-for-files-stored-on-sharepoint-2/

    Cheers

  15. Tom

    Helpful for such a bewildering set of rapidly evolving tools and services.
    I was wondering if you had any thoughts on using “Connection Only” from Power Query and not including in the Data Model. For example, if I’m doing work in a version (license) of Excel that does have PowerPivot. From Power Query I can choose “Connection Only” and separately whether to add to the Data Model. Without PowerPivot, I don’t know why I’d add to the Data Model? Maybe because I’d be sharing it with someone who has PowerPivot or plan to evolve to a version that does? Also, Microsoft provides very little documentation on what a “Connection Only” does or doesn’t do. I know that it cannot be refreshed, but am searching in vain to assure myself that if I had a query that does load to the workbook, but depends on a “Connection Only” (which in turn depends on a “Connection Only”, etc.) that a Refresh All will really refresh correctly (sequentially).

Leave a Reply

Your email address will not be published.