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?

I recommend EndNote to all my students who I supervise on dissertations at undergraduate, postgraduate, and doctoral levels. Sometimes they ask if I get commission for doing this, which I do not. But the software is great, and fantastic time saver when putting journal articles or theses together.

DF, W Yorks, UK

I have had a very helpful response, and have passed it on to my Oxford colleagues with success. I am impressed with the way Adept seems to maintain the same staff for many years, which speaks very well for the organisation.

HG, Oxford, UK

I have to thank you again for your help. The support level you have given gives me good confidence in using the product, knowing that there are solutions to problems that are not necessarily easy (or economic) for you to implement, but give the customer a working solution.

CW, Cheltenham, UK

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

JS, Dundee, UK

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.