Rest Library for Google Apps Script

In previous posts I covered a couple of conversions of Excel VBA projects to Google Apps Script, with particular emphasis on maintaining compatibility between the solutions to allow for dual maintenance. Previous conversions have been a GAS Color Ramp and a GAS roadmapper.

This latest migration makes a GAS version of the Excel Rest library, This allows you to store a list of useful REST queries, and execute them to populate a worksheet both in Excel and Google Spreadsheets

Queries are very simply added – Here are a couple of examples. Included in the code are a whole bunch of GAS hacks which mimic VBA behavior to make these kind of conversions simple.

This is a simple geoCoding query using Yahoo geocoding rest API.
GAS version
function testYahooGeocode() {
    generalDataSetQuery (“geocoding”, “yahoo geocode”, “input address”);

VBA version
Public Sub testYahooGeocode()
    generalDataSetQuery “geocoding”, “yahoo geocode”, “input address”
End Sub
Here’s another – an interactive query on the iTunes Database
GAS version
function testItunesMovie() {
    generalQuery (“itunesmovie”, “itunes movie”, 
        InputBox(“Enter your itunes movie search query (eg. artist name)”));

VBA version
Public Sub testItunesMovie()
    generalQuery “itunesmovie”, “itunes movie”, _
        InputBox(prompt:=”Enter your itunes movie search query (eg. artist name)”, _
             Title:=”itunes API query:results to the itunesmovie worksheet”)
End Sub

For more information and to download the VBA and GAS versions, see the ramblings site.

Author: brucemcp

2 thoughts on “Rest Library for Google Apps Script

Leave a Reply

Your email address will not be published. Required fields are marked *