Importing Data from Web Pages


You've found a web page containing useful data that you'd like to use in a spreadsheet; however, you don't feel like retyping it all in.


There are a few ways to get the data from a web page into Excel without having to retype it all. You could try copying and pasting, but this may give you format problems. You could also try saving the web page as a text file, but the formatting of the web page may make this cumbersome.

The most direct way to import data from a web page uses Excel's built-in capability to import data from tables and preformatted areas contained in web pages . From within Excel, select Data images/U2192.jpg border=0> Import External Data images/U2192.jpg border=0> New Web Query....


Upon selecting Data Import External Data images/U2192.jpg border=0> New Web Query... from the main menu bar, youll see the New Web Query window shown in Figure 3-11. The New Web Query window is essentially a web browser. You can type in a URL in the address bar to go to the page containing the data you'd like to import. You can also navigate using the forward and back buttons (the circular ones with arrows, to the right of the Go button in the toolbar).

A key difference between this window and your usual web browser is that this window analyzes the web page to determine which data you can import. Each block of data that can be imported is marked with a little arrow icon in the block's upper-left corner, as shown in Figure 3-11. If you drag you mouse over one of these icons, the corresponding data block will be highlighted. Click the icon to select that block of data (the arrow will turn into a checkbox). Click the arrow icon in the upper-left corner of the page to import the entire page. Once you've selected the blocks of data you'd like to import, press the Import button.

The results of this action for the page displayed in Figure 3-11 are shown in Figure 3-12. Notice that the External Data toolbar is shown when the web query is completed, just as in the earlier example showing how to import data from an Access database. You can use the External Data toolbar to manipulate the web query. For example, if you press the refresh button, Excel will attempt to refresh the data obtained from the web page by reaccessing the page over the Internet. This can be useful if the data you've imported changes frequently.

Once you've imported the data, you can use it in your own analyses or manipulate it further using other techniques discussed in this chapter.

Figure 3-11. New Web Query window


See Also

You can save your web queries and rerun them at later times from other workbooks if you'd like. This is useful if you want to use the data in more than one workbook. You can save the query by pressing the save icon in the New Web Query window (see Figure 3-11). For more information see the help topic "Query for data from a Web page" in Excel's online help.

Using Excel

Getting Acquainted with Visual Basic for Applications

Collecting and Cleaning Up Data


Statistical Analysis

Time Series Analysis

Mathematical Functions

Curve Fitting and Regression

Solving Equations

Numerical Integration and Differentiation

Solving Ordinary Differential Equations

Solving Partial Differential Equations

Performing Optimization Analyses in Excel

Introduction to Financial Calculations


show all menu

Excel Scientific and Engineering Cookbook
Excel Scientific and Engineering Cookbook (Cookbooks (OReilly))
ISBN: 0596008791
EAN: 2147483647
Year: N/A
Pages: 206
Authors: David M Bourg
Similar book on Amazon © 2008-2017.
If you may any questions please contact us: