OpenCorporate data Excel REST query

I got this idea from Tony Hirst’s great blog. The OpenCorporates API gives rich information many companies. Using Google Refine to reconcile, it cleans up many sources of data to a queryable datasource.

So here is an initially very simple entry for the rest-Excel library that takes a query and populates a worksheet with information on all the companies registered similar to that query. Here’s the first few lines of a query on ‘Google’

I used the rest Explorer to see what data this kind of response this thing returns, and picked a few coumn headings to be populated as above. The library entry is pretty straightforward and looks like this

      With .add("opencorporates reconcile")
            .add "restType", erSingleQuery
            .add "url", "http://opencorporates.com/reconcile?query="
            .add "results", "result"
            .add "treeSearch", True
            .add "ignore", vbNullString
        End With

 

and the code to execute the query looks like this

Public Sub testOpenCorporates()
    generalQuery "opencorporates", "opencorporates reconcile", _
        InputBox(prompt:="Enter your openCorporates search query", _
             Title:="openCorporates API query:results to the opencorporates worksheet")
End Sub

I’ll be returning to this topic in the future as I dig a little more into this API. This is example is in the cDataSet.xlsm workbook and can be downloaded from the ramblings site.

About brucemcp 225 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.