Created
December 2, 2016 21:47
-
-
Save terrywbrady/86c5690fa1828c6914deb5efc5210340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isbnLookup(id) { | |
var url = "https://www.googleapis.com/books/v1/volumes?country=US&q=isbn:"+id; | |
var options = {contentType : "application/json"}; | |
var resp = UrlFetchApp.fetch(url, options); | |
if (resp == null || resp == "") return "N/A"; | |
var respdata = JSON.parse(resp.getContentText()); | |
if (respdata["items"].length == 0) return "Not found"; | |
return respdata["items"][0]["volumeInfo"]["title"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment