Get Current Weather in Excel

Automate Excel

Get Current Weather in Excel

I was just browsing the article 15 things you can do with RSS and noticed that WunderGround provides an RSS feed for weather (the option is available after doing a search).

Knowing that RSS is consumable with Excel (XML versions), I whipped up a barebones* example of getting the current and daily forecasted weather into Excel.

You can download the Weather Spreadseet here.

Simply enter a City and State and hit the “Get Weather” button. If the inputs are valid, your spreadsheet will return data looking something like this:

Looks like possible rain for the running of the derby today ;-)

*This is a barebones example to demonstrate how to get weather into Excel. I included only an “On Error Resume Next” instead of detailed error handling, and the weather is returned as single string (ideally this string would be parsed).

Related posts

2 Responses

  1. David Wasserman Says:

    Mark,
    I had trouble getting the weather workbook to work. I am working on Excel XP on Windows 2000 Professional. When I click the button to get the weather, nothing happens. When I remove the On Error line, I get an error with the XMLMaps(”weather”).

    Is there something I can do to fix this?

    Thank you.

    David

  2. Mark Says:

    David,

    Thanks for testing it out, unfortunately I don’t have Excel XP currently installed, however a quick search turned up this:

    It looks like to import a URL you need to use DATABINDING. You can read more on it about halfway down on this page.

    Just a guess:

    Change this line of code

    ActiveWorkbook.XmlMaps(”weather”).Import URL:=”http://www.weatherunderground.com/auto/rss_full/” & _
    state2search4 & “/” & city2search4Corrected & “.xml”

    To this

    ActiveWorkbook.XmlMaps(”SalesOrder”).DataBinding.LoadSettings _
    URL:=”http://www.weatherunderground.com/auto/rss_full/” & _
    state2search4 & “/” & city2search4Corrected & “.xml”
    ‘return it
    ActiveWorkbook.XmlMaps(”weather”).DataBinding.LoadSettings _
    URL:=”http://www.weatherunderground.com/auto/rss_full/” & _
    state2search4 & “/” & city2search4Corrected & “.xml”

    ActiveWorkbook.XmlMaps(”weather”).DataBinding.Refresh

    That works in 2003 also, and according to the article I linked to should work for you,, let me know how things turn out.

    mark

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.