Pull External Data into Excel
Often, we use Excel to summarize detail that comes from some other program or accounting system. There are essentially three ways that I am aware of to get data from another program into a destination Excel worksheet, I’ll nickname them:
The Copy/Paste method is probably the most common. It is when you basically view or export the data to a new Excel, csv or text file, and then copy and paste the data into the destination Excel worksheet.. It is easy to use and works well. However, other methods may be more efficient for recurring use workbooks.
You can pull the data directly from the external data source using the External Data feature of Excel. This post focuses on this feature, and the details are found below.
You can also push the data from the system into a specific worksheet in an existing workbook. Not all applications support this method, but when they do, it will save a step.
Now, let’s spend the rest of our time working through the External Data feature.
The External Data feature has been in Excel for a long time, and I first started using it in about 1997. This feature made a big improvement in my workflow and increased my productivity. Since then, I’ve been a huge fan of this feature! It is one of those things that is just sitting there waiting to be discovered and put to use.
External Data Overview
First, let’s start with what the feature does, and then we’ll move on to how to use it. External data is defined as data that exists outside of the Excel workbook, in some other place. That other place could be almost anywhere, and Excel supports pulling external data from a wide variety of sources. Examples include data stored on web pages, in text files, or in other programs.
Programs that store large amounts of data are often built upon a database engine or platform. You, as the user, see the program’s user interface which is made up of menus, icons, dialog boxes, and forms. Behind the scenes however, applications often store their data in a database. It is this underlying database that Excel can often tap into with the External Data feature.
This feature doesn’t pull a single value into a single cell. It retrieves a block of data, or a table, that will ultimately occupy a range of cells.
The External Data feature asks you to identify the location of the data you want. Once you do, Excel retrieves the data and places it into the selected worksheet. The best part of this feature lies in the fact that the External Data range is not static….it can be refreshed. When you click the refresh button, Excel heads out to the data source and pulls back the updated data. This improves the efficiency of recurring use workbooks because you don’t need to do the whole export, import, reformat routine that is needed with the standard copy/paste method. You simply click the refresh button, and bam, the updated data just appears in your worksheet.
How to Pull External Data
Excel supports pulling data from a wide variety of data sources. Examples include web pages, text files such as csv files, SQL, Access, ODBC compliant sources, and more. The basic process is that you first identify the type of data source and then the location. Depending on the type of source, you’ll have appropriate options. For example, if you are pulling data from an Access database, you’ll identify the table or query, and then which columns and rows you want.
For this post, I wanted to use a data source that you’ll have access to in case you want to work along. So, we’ll pull some external data from a web page.
We tell Excel that we want to retrieve data from an external source by first identifying the type of source. This is done by selecting the appropriate ribbon icon from the Data tab as shown below.
For this simple example, we want to get data from a web page. Our objective is to pull historical closing stock prices for Apple. So we click the From Web icon from the Data ribbon. This will reveal the next step in the process, which is to identify the web page. We’ll head over to the Yahoo Finance page, so we enter the URL http://finance.yahoo.com into the address field, as shown below.
Next, we enter the stock symbol AAPL for Apple into the web page, and click the Get Quotes button. We scroll down the page a bit, until we see the “Historical Prices” link on the left. We click it, and we can see the daily closing prices. We click the yellow arrow for the Prices table, and see that Excel identifies the range with a border and changes the yellow arrow to a green check, as shown below.
Next, we click the Import button and then tell Excel where we want the data to be placed, and bam, we have it in our Excel worksheet, as shown below.
The best part is that if we want to refresh the data, we don’t need to go through all of the setup steps again, we just need to click the refresh button on the Data ribbon tab, or, right-click the external data range and select Refresh. Excel will go back to the data source, retrieve the updated data and drop it, automagically, into the worksheet.
For recurring processes, the External Data feature is probably more efficient than the standard copy/paste approach since you simply click the Refresh button to retrieve updated data. There are many external data sources that are compatible with this feature. This post only provided a simple warm-up. There is a lot more to explore as this feature supports a wide range of data types, sources, and options. You can even set up a parameter query, where the criteria is placed in an Excel worksheet. The criteria values stored in Excel are relayed to the external data source during the retrieval, and this makes it easy to filter the data before it hits the worksheet. Excel Rules!
Excel is not what it used to be.
You need the Excel Proficiency Roadmap now. Includes 6 steps for a successful journey, 3 things to avoid, and weekly Excel tips.
Want to learn Excel?
Access all Undergrad and Masters lessons with a Campus Pass or CPE Pass. Includes on-demand training plus live office hours.