AppsScriptPulse

The Ultimate Google Apps Script Front-End Development Guide. Part 0: The Worst and the Best Practices

Welcome to the Ultimate Google Ultimate Google Apps Script Front-End Development Guide!

If you are reading this post, then you likely have experience with Google Apps Script. Essentially, there are three types of front-ends that you can create with Apps Script:

  • Web apps
  • Modal/modeless dialogues
  • Sidebars

In this blog post series, we will only discuss HTML front-ends, as this is where you can create the most powerful and sophisticated user experiences. Unfortunately, the Card Service is outside the scope of this series, and it is not nearly as powerful as an HTML front-end. With that in mind, Google, how about allowing HTML front-ends for Workspace add-ons?

Source: The Ultimate Google Apps Script Front-End Development Guide. Part 0: The Worst and the Best Practices

Handling Google Forms checkbox responses with Google Apps Script

Get Google Form responses for checkbox-type questions and perform further actions depending on their values.

Get all checkbox responses from a Form

Get all checkbox responses from a Form

The following Google Apps Script is an example of one way to get the responses from a Checkbox-type question on a Google Form and how you might go about differentiating them.

This came up for a project I was working on where I need to put a Yes/No value into 3 separate Google Sheet cells based on 3 options in a question. The slight challenge is that all of the responses come out as a single array for this question, containing the strings of the values that have been ticked only.

Source: The Gift of Script: Google Form Checkbox responses

Setup automated reminders in Google Forms/Google Sheets with Apps Script

 

In this article I’ll show you how to setup reminder emails that will get sent automatically each day if there are any pending tasks in your spreadsheet. Stay tuned until the end, where I’ll show you an easier way to accomplish this using Coda.

Eric Koleda must be the undisputed master of the Apps Script demo. The ‘random cat’ Add-on, is one of my favourite examples where Eric finds a really simple hook to get you engaged in what can often be a complex project. Eric is now Developer Advocate at Coda and he’s not lost is eye. In this post Eric gives the gift of script with a basic example of how you can handle email notifications from Google Form responses in batches with a timed trigger (cats being replaced for cakes). Eric also shows how a no-code alternative can be accomplished in Coda.

Source: Setup automated reminders in Google Sheets

Opening and closing Google Forms on time trigger using Google Apps Script

This is a sample script for opening and closing Google Forms on time using Google Apps Script.

Here’s a handy little snippet if you would like to programmatically open/close one of your Google Forms to responses for specific hours of the day. The script includes another trigger that will repeat opening/closing the Google Form for responses each day. As this snippet uses .timeBased().at(date)  it’s easy for you to modify if you want to only have the form open to responses between two specific dates/times.

Source: Opening and Closing Google Forms on Time using Google Apps Script

Creating a custom workflows using Google Forms and Google Sheets for provisioning virtual machines (VM) in Google Cloud

Is it possible to integrate Google Workspace tools such as Calendar, Sheets, and Forms with Workflows? For example, can you trigger a workflow from a Google Form or a Sheet? Turns out, this is not only possible but also easier than you might think. Let me show you how with a sample use case.

One of the great things about Google Workspace is there is never ‘one’ solution, there is enough flexibility for you to implement one of many workflows. A case in point is this post highlighting a Google Forms/Sheets powered approval system for allocating virtual machines (VM) to your users. As part of this the workflow includes calling the Compute Engine API to create the VM in Google Cloud.

Source: Triggering Workflows from Google Sheets

GWAOw! 4 – Forms History a Google Forms Add-on by Martin Hawksey

Forms History is a Google Workspace Add-on that allows you to monitor your version history and store copies in Google Forms

Not just talking the talk, but also walking the walk. Shortly before taking a new role at CTS, the largest dedicated Google Cloud Partner in Europe, I published Forms History an add-on to enable revision history functionality in Google Forms.

Fellow Google Developers Expert, Scott Donald, has picked this up in the latest episode of GWAOw! his dedicated to Google Workspace Add-on review show. You can follow the source link for the YouTube clip and more. As part of the episode Scott rightly highlights the creative work of Alice Keeler, which hasn’t just included artwork but Alice has also provided a huge amount of support in promo and usability.

If you are interested in the inner workings of Forms History there is a related post on Working with the Google Drive API Revisions history: Tips for handling revision merges with Google Apps Script.

Source: GWAOw! 4 – Forms History by Martin Hawksey – Yagisanatode

Create and run polls in Google Slides using Google Forms and Google Sheets

Image credit: Prateek Sharma

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. … Since I am giving presentation using Google tools, I thought let’s try it out with Google Apps Script.

I thought this was a nice little Apps Script snippet from Prateek Sharma which hooks into a .onFormSubmit() trigger to update all charts embedded from Google Sheets in a Google Slides presentation. Prateek provides detailed steps including the code for setting this up. Unfortunately, a limitation of Google Slides is once you go into ‘slideshow’ mode all charts become static images so you need to jump back to the editor view to show real-time results.

Source: Create and Run Polls in Google Slides using Google Forms & Google Sheets

How to preserve formatting of Google Forms responses in Google Sheets with Google Apps Script

Learn how to automatically preserve the formatting in Google Sheet when new Google Form responses are submitted.

Handy little Apps Script snippet from Amit Agarwal should you need to keep any custom formatting applied to linked Google Forms responses in Google Sheets. Another way you can approach this is using ARRAYFORMULA to reference the form responses in another sheet and apply your desired formatting.

The default ‘Form responses’ sheet can be hidden if needed. Downside of using ARRAYFORMULA is you are referencing a cell range which can cause confusion when using features like sort. See the source link for all the code used in Amit’s solution.

Source: How to Auto Format Google Form Responses in Google Sheets – Digital Inspiration

Google Apps Script developer notes on using the new Google Forms REST API

Google recently announced the general availability of the new Google Forms API. For developers familiar with Google Apps Script for some time it has been possible to create, access, and modify Google Forms through the Forms Service. In this post I will highlight why Google Apps Script developers might want to use the new Forms API and some resources I’ve found useful for working with the new API in Apps Script projects. As part of this I’d like to share my experience of using the Forms API within a Google Forms Add-on and some factors to consider if you are particularly interested in watching for Google Form edits.

The Google Forms REST API provides an alternative method for managing Google Forms and responses. For Apps Script developers it is likely you’ll want to stick with using the Forms Service, but the new API is useful to know about as it opens up some new ways for managing, editing and watching Google Forms.

Source: Google Apps Script developer notes on using the new Google Forms REST API

Introducing the Google Forms API – Use cases and example applications

Image credit: Google

For the first time, Google Forms has an API and we are going to show you how you can use it and what’s in it. The new Google Forms API joins the large family of APIs available to developers under the Google Workspace Platform. The Forms API provides programmatic access for managing forms, acting on responses, and empowering developers to build powerful integrations on top of Forms.

Some additional resources to support the general availability of the Google Forms API have been published. This post includes information on the key use cases which are supported by the API:

Automated form creation and editing: Enables automated form creation and editing. Enables rapid form generation from large volume question banks or other data backends.

Reaction to Form responses: The API also enables developers to build automations for acting on incoming responses. Examples include developing real-time dashboards or visualizations and triggering business workflows based on response data.

Given the existing widespread use of Google Forms in education it was nice for this to be acknowledged and also to see Automagical Forms getting mentioned.

Source: Introducing the Google Forms API