Create and Run Polls in Google Slides using Google Forms & Google Sheets
I wanted to give a presentation to a group of people. In order to make the presentation more engaging & eliminate silences during the slideshow, I thought of conducting polls in between. I searched for tools online & came across a few options:
These are amazing tools with freemium pricing structure.
Since I am giving presentation using Google tools, I thought let's try it out with Google Apps Script.
Step 1: Create a new presentation using Google Slides
You can create a new slide deck either by going through Google Drive or typing slide.new in the address bar of your browser.
Note down the Google Slide deck file ID from the browser address bar:
Step 2: Create a new poll using Google Form
You can create a new form either by going through Google Drive or typing form.new in the address bar of your browser.
Note down the Google Form file ID from the browser address bar:
Let's put a question in Google Form:
Now, link a Google Sheet with this form:
You will be taken to Google Sheet by clicking Create button. Select Column B which will hold your answer for Google Form. Go to Insert & click on Chart.
Step 3: Insert chart in Google Slides deck from Google Sheets
Go to your slide deck and import chart from Google Sheet.
Step 4: Writing script for Google Form
Please note that you need to paste the Google Slides ID (from Step-1) & Google Forms ID (from Step-2) in place of SLIDE-ID & FORM-ID respectively.
In this code, we are registering a trigger which will run when user submits the Google Form (poll which you have created).
Now select createTrigger function & click Run button
When you run this script for the first time, it will ask your permission. Just select your Google account, give permission to this script, click on advanced & continue. You can verify whether the trigger has been created successfully or not.
Now, in order to try your poll, click on the Preview button. It will take you to a new tab where you can fill in the sample response.
Now, if I select Nelson Mandela & submit the form, it will automatically be updated in the Google Slide Deck.
- If you are in slideshow mode of your presentation, then you won't be able to see the live poll results. You need to go back to your editor mode to see real time results.
- You can use URL Shortner or QR Codes to share the Google Form link. I have created a sample slide for you to take a clue.
- In updateSlidesChart function mentioned in script file, I am checking every slide for Sheets Charts & if chart is present, then I am updating the same with latest data. You can update the selective slide by using getSlideById function instead of getSlides (if you want to).
- Please note that Google Apps Script has limitations on Apps Script runtime. For every form submission, in the above-mentioned example, it takes around ~2 seconds. You can bring down this time by selective updation of slide which contains Sheets Charts by using getSlideById function. Apart from this, there are other errors which users might face like “Script invoked too many times per second for this Google user account” which I am not able to reproduce due to limited audience sample set.