Connect Mathcad to Internet Data Sources

One little-known feature of Mathcad 15 (and earlier versions) is the ability to connect to Internet data sources. Simply insert a scriptable component into a worksheet, define an input and an output, and insert this VBScript into the component code.

Function IEGetPage(URL)
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Navigate URL
  Do While IE.Busy
  IEGetPage = IE.Document.Body.outerText
 End Function

IEGetPage(URL) is a function that downloads the data the URL points to.

This function can be used to define the output of the scriptable component. For example, you could insert the following code into a push button event (PushBtnEvent_Exec)

Outputs(0).value = IEGetPage(Inputs(0).Value)

Outputs(0).value and Inputs(0).Value refer to the first input and output of the scriptable component. In this instance, the input would simply be a URL and the output would be the downloaded data.

So what can I do with this surprisingly cool functionality? Well, the US Geological Survey host constantly updated earthquake data on their website. This data gives the location (i.e. the latitude and longitude) and magnitude of earthquakes over a rolling time period, and can be downloaded as a text file. is a typical example.

This text file is updated several times a day with new earthquake data and can be downloaded straight into Mathcad using the VBScript given above.  Check out this Mathcad worksheet (the link is at the bottom of this post).

Once the data the data is in Mathcad, some parsing is needed to strip out headers and other unnecessary information.  You can then manipulate and analyse the filtered data.

In the Mathcad worksheet, I’ve plotted the location of earthquakes on a map of North America (the mapping data is low resolution, but it serves its purpose). Here’s what the plot looks like:

My next mini-project (should I get some time off from the salt mines) is to project this earthquake data onto a globe.

I’ve also connected Mathcad to other Internet data sources, including historical stock quotes and foreign exchange rates.

Mathcad Worksheet to Download Earthquake Data from the US Geological Survey Website

What do our Customers say about us?

Thanks again for your help. EndNote is a great product and I am constantly telling students, colleagues and friends about it.

JS, Dundee, UK

Your web page is simply brilliant. Congratulations!

CF, Kirknewton, UK

I had just upgraded to Windows 7, and after having Mathcad for several years I found that I could not complete the final stages of installation. After reading help files I finished up confused and really helpless, until I contacted you. THANK YOU.

JD, Dorset, UK

Very happy with the service. Very professional staff and always helpful.

UO, Athlone, Ireland

For the time being we are unable to offer the following product ranges although we are currently working hard to increase the number of products we can offer in the future. Please contact us to talk about alternative products that we may be able to offer you.