O'Reilly logo

Baseball Hacks by Joseph Adler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Use Microsoft Excel Web Queries to Get Stats

Create a spreadsheet of baseball statistics in Microsoft Excel 2003 that takes statistics directly from web sites using web queries.

Over the past few years, Microsoft has been adding more Internet functionality to the Office suite of applications (such as the ability to directly save and load HTML-format files). In Office 2003, Microsoft added some great new features to enable Office to read parts of web pages directly. If you’re a baseball fan and you like to use Microsoft Excel, you’ll find this feature really cool.

Web Queries

Web queries let you pull data from a web page directly into Microsoft Excel. If the web site is updated over time, your spreadsheet can also be updated. Even better, you can do this without any fancy Visual Basic scripting. Here is how to create a web query:

  1. Open a new workbook, or create a new worksheet in an existing workbook.

  2. Select New Web Query… from the Import External Data submenu in the Data menu.

  3. A dialog box will appear, resembling the one in Figure 3-1. Type into the Address box the URL for the web site from which you want to fetch the data, and then click the Go button. This dialog box uses Internet Explorer to fetch and render web pages; there is a full working web browser in this dialog box. This means you can fill out forms on web sites or navigate to different sites from within the dialog box (no need to remember ugly URLs like the one in this example).

    Figure 3-1. New Web Query dialog box

  4. When the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required