Populate Google Spreadsheet cells with JSON API data, conversion tutorial
For this tutorial we will populate Google Spreadsheets cells with API data, target columns and rows on it.
First check the archived page for the ImportJSON documentation at https://rawgit.com/bradjasper/ImportJSON/master/archive/blog.fastfedora.com/projects/import-json.html
Next open up the latest version of ImportJSON script found at this repo link https://github.com/bradjasper/ImportJSON
Open ImportJSON.gs, click raw > copy the whole script
Now on google spreadsheet, create new spreadsheet or open existing one which you'll populate data with
Click Tools > Script Editor
It will popup a new tab/window, delete the default script inside
Then paste the ImportJSON code you've copied from the repo
Save and name the project
Now back to the spreadsheet click cell A1, from the documentation we know how to call the function ImportJSON
I'll be using this sample JSON API link https://api.github.com/users/hadley/repos
on cell A1 value paste
=ImportJSON("https://api.github.com/users/hadley/repos", "/id,/fullname,/owner/html_url,/owner/avatar_url", "noInherit, noTruncate")
**You can add all other data on the 2nd parameter, for nested data you will add them by full url like how I did with /owner/avatar_url since avatar_url is under owner, etc
After pasting the value for cell A1, it will take time to load data depending on how big or how many columns you'll have on yours so just be patient... after that you will see the data populate, enjoy! ;)
Comments
Post a Comment