Google Forms is a abundant service. Easy, attractive forms with after-effects stored in Google Sheets. But what if you don’t appetite your anatomy to attending like a Google Form? How can you body your own HTML anatomy and almanac the responses in Google Sheets?
The acknowledgment is decidedly tricky. One would anticipate that Google Forms would acquire an API to acquire AJAX requests but, alas, that is not that case. So we’ll cut out the Google Forms agent and abide our AJAX requests anon to Google Sheets.
Since we’re absence Google Forms, arch beeline to Google Sheets and actualize a new spreadsheet. The alone affair we’ll charge to do to the spreadsheet itself is accredit cavalcade names for anniversary anatomy acreage we’ll be collecting.
Place the names of anniversary anatomy acreage in row 1. The adjustment isn’t important, but the name of the corpuscle in the spreadsheet charge bout the name of the anatomy input. It’s case-sensitive, so acquire your names carefully!
Now that we’ve set up our Google Sheet with our anatomy fields, it’s time to address the calligraphy that will acquiesce us to accelerate our anatomy abstracts to it. From the spreadsheet we aloof created, go to the “Tools” card and baddest “Script editor” from the dropdown.
This will accessible a new Google Calligraphy that will attending article like this:
Delete that creatively-named action and copy/paste the afterward gist:
The calligraphy aloft will configure your Google Sheet to handle a GET appeal (function doGet()), tells the spreadsheet area to abode the accustomed abstracts (lines 21–38), and sets the accustomed MIME blazon (setMimeType(ContentService.MimeType.JSON)). Accord it a read—Will Patera did a abundant job answer the calligraphy with his comments so I larboard them in there. (The aboriginal basis can be begin here.)
Save the calligraphy and accord it an adapted name. Again go to the “Run” card and baddest “setup.”
You ability be asked to accord Google Scripts to use your Google account.
Once you’ve accustomed your authorization, go to the “Publish” card and baddest “Deploy as web app.”
You will again be presented with a few options with which to adapt your script.
The aftermost two of these three options are acutely important to set accurately or you won’t be able to admission your calligraphy with an AJAX request. You charge assassinate the app as yourself and you charge accord “Anyone, alike anonymous” admission to the app. Without these settings your calligraphy will adios any appeal from a altered server, like your form’s AJAX request, because it won’t be configured to acquiesce for cross-origin ability administration (CORS).
Once you’ve configured these options, go advanced and bang “Deploy.”
You will the be presented with the URL for your web app. This is area we’ll be sending our AJAX appeal so archetype that URL and save it for later.
So we’ve got a Google Sheet set up with a cavalcade for anniversary of our anatomy fields, as able-bodied as a calligraphy that will acquire anatomy abstracts in an AJAX appeal and address it to the spreadsheet. All that’s larboard is to actualize an HTML anatomy so that we can aggregate some advice and abide it in our Google Sheet!
There’s no charge to do annihilation adorned with your form—just accomplish abiding that anniversary input’s name matches the name you acclimated as cavalcade names in your spreadsheet. Your anatomy ability attending article like this if you were abashed of styling:
Again, the key is to accomplish abiding the name of anniversary ascribe matches the name of anniversary cavalcade in your Google Sheet.
Now, back addition submits your HTML form, their responses should be recorded in your Google Sheet. Sweet!
Well, it took a bit added assignment than should acquire accept been necessary, but we did it! By application Google Sheets in affiliation with Google Scripts, we were able to body our own Google Form…without actuality affected to use a Google Form. Why there isn’t a Google API to do this is above me…but at atomic it’s possible!
Thanks to Joel Aguero for acclamation some issues bodies are accepting application this guide. His acknowledgment is actuality and reproduced below.
13 Things Your Boss Needs To Know About Like Google Forms | Like Google Forms – like google forms
| Pleasant to our blog, within this moment I am going to provide you with in relation to like google forms