appscript - Google App Script automatic form creation - Stack Overflow
appscript - Google App Script automatic form creation - Stack Overflow | google forms web app

Google Forms Web App Is So Famous, But Why? | Google Forms Web App

Posted on

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?

appscript - Google App Script automatic form creation - Stack Overflow - google forms web app
appscript – Google App Script automatic form creation – Stack Overflow – google forms web app | google forms web app

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!

10
10 | google forms web app

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:

Google Form for Parent Teacher Conference Sign-Up - YouTube - google forms web app
Google Form for Parent Teacher Conference Sign-Up – YouTube – google forms web app | google forms web app

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.

Google App Tipps: Formulare mit Passwort schützen | Publishingblog
Google App Tipps: Formulare mit Passwort schützen | Publishingblog | google forms web app

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).

Quickstart: Add-on for Google Forms | Apps Script | Google ..
Quickstart: Add-on for Google Forms | Apps Script | Google .. | google forms web app

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!

Google Forms - 10to10Google - google forms web app
Google Forms – 10to10Google – google forms web app | google forms web app

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.

Finally, we’ll affix our HTML anatomy with our Google Calligraphy with a little JavaScript/jQuery. Nothing too crazy here, either. We’re preventing the anatomy from appointment commonly and instead amalgam an AJAX appeal to the URL for our web app/script that we acquired earlier.

The 10 Best Free Form Apps and Survey Builder Tools - google forms web app
The 10 Best Free Form Apps and Survey Builder Tools – google forms web app | google forms web app

The alone absorbing allotment is the abstracts that we’re sending. Our calligraphy is assured a JSON data-type so we’ll acquire to catechumen our anatomy abstracts into a JSON object. I chose to do this with the jQuery Serialize Article script, which provides the serializeObject() method, and will catechumen our anatomy into a JavaScript object. You can break this botheration about you’d like—as continued as your abstracts is structured like JSON!

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!

How to Create Google Forms with File Uploads - google forms web app
How to Create Google Forms with File Uploads – google forms web app | google forms web app

Thanks to Joel Aguero for acclamation some issues bodies are accepting application this guide. His acknowledgment is actuality and reproduced below.

Google Forms Web App Is So Famous, But Why? | Google Forms Web App – google forms web app
| Allowed to my personal blog, within this moment I will provide you with regarding google forms web app
.

Apps | Google Forms - google forms web app
Apps | Google Forms – google forms web app | google forms web app
The 10 Best Free Form Apps and Survey Builder Tools - google forms web app
The 10 Best Free Form Apps and Survey Builder Tools – google forms web app | google forms web app

Gallery for Google Forms Web App Is So Famous, But Why? | Google Forms Web App