Fun Share: Google Form Viewer (aka google form to json)

i found an open source (free) API that can read Google Form content and returns it in JSON!

Consider this sample google form. it includes all the types of questions you can build with google forms.

the form is partially reproduced below:

the API is really simple to use. in order to read the form above, type the following in a browser:

if you look closely the string following the site is the file id of the form (string between “…/forms/d/e/” and “/viewform?formkey” in the google form url above).

during the first iteration through the webapi block, i wasn’t getting any data - i suspected a CORS (cross origin) issue so i used a CORS Proxy - a work around for dealing with this (see this link) and it worked!

(EDIT. i just checked recently - and the CORS issue is gone - so i had deleted the blocks for going through a CORS proxy)

it’s straight forward from there the screen below shows the form title, description and all the questions included in that form. (Note that this app only reads the form’s content - NOT the responses).

this next screen shows more details about the question selected (red arrow above)

this is the raw json returned from calling the api to view the google form above:
{"title":"Google Form Sample [Form]","description":"Here are all of the question types","collectEmails":"NONE","questions":[{"title":"This is a text question","description":"Limited space for typed response. Great space for name of respondee or short answer","type":"TEXT","options":[],"required":false,"id":1000000},{"title":"This is a paragraph question","description":"Extended space for longer answer","type":"PARAGRAPH_TEXT","options":[],"required":false,"id":1000001},{"title":"This is a multiple choice question","description":"May click one of the choices or respond to \"other\"","type":"MULTIPLE_CHOICE","options":["Choice 1","Choice 2"],"required":false,"id":1000002},{"title":"This is a checkbox question","description":"Similar to multiple choice; multiple responses available","type":"CHECKBOXES","options":["Choice 1","Choice 2"],"required":false,"id":1000003},{"title":"This is a choose from a list question","description":"Drop down menu format","type":"DROPDOWN","options":["Choice 1","Choice 2","Choice 3"],"required":false,"id":1000004},{"title":"This is a scale question","description":"You may change the scale up to 10; Similar to Likert Scale","type":"SCALE","options":["1","2","3","4","5"],"required":false,"id":1000006},{"title":"This is a grid question","description":"Rate Your Google Form Knowledge - Multiple Responses Available","type":"GRID","options":["I get it","I have a pretty good grasp","Neutral","I am struggling","I don't get it"],"required":false,"id":1000007}],"error":false}

here’s the main logic

and here’s the project link for remix:

to learn more about this API, i encourage you to visit the github page

you can read further on how to update the form (ie. add a new response) by using the same API.