AppsScriptPulse

Dynamically remove Google Form options

Screenshot of Google Form appointment slots
Google Form appointment slots

This was developed as I wanted to learn about removing Google Form option choices as part of exploring its capabilities for use with appointment slots. I am aware there are a number of Google add-ons that achieve this but they come with potential data protection issues when accessing your Google Account, hence an in-house approach.

The principle is simply that a user would select their desired appointment slot on the Form and then that option would be unavailable for the next user accessing the Form.

Source: The Gift of Script: Dynamically remove Google Form options

Copy template sheet to Google Sheets and reorder

Template sheet with signatures to copy to other files

Screenshot of template sheet with signatures to copy to other files

Take a template Google Sheet (containing fields for 3 signatures) and copy it into other Google Sheet files within a given Google Drive folder and then reorder those sheets so that it was the first one.

The idea was based around needing users to authorise student marks with their signature from multiple Google Sheet reports produced from a third party system.

Source: The Gift of Script: Copy template sheet to Google Sheets and reorder

Batch get existing Google Drive folder IDs & names

Get the folder IDs of a large number of current Google drive folders along with parts of their name – for capturing in a Google Sheet.

Source: The Gift of Script: Batch get existing folder IDs & names – version 2.0

Filling out your column data to match the number of columns in a range – Yagisanatode

Have you ever experienced the warning about “number of columns in the data does not match the number of columns in the range” when trying to set values or paste a range of values back into your Google Sheet with Google Apps Script?

Check out this post to see how this script can help you fill out your column data to match the number of columns in a range.

Source: Google Apps Script: Filling out your column data to match the number of columns in a range – Yagisanatode

Adding data from spreadsheet to custom fields in Google Contacts with Google Apps Script

At my work data of clients, opposing parties, courts, third parties and cases (among which case names) are stored in a spreadsheet. The spreadsheet is the source for contacts in Google Contacts.

For some reason names of cases are used as subject in Gmail. I use(d) Google Apps Script to add case names to Google Contacts

Nice little script example to navigate around and add data to Google Contacts.

Source: /**There must be a better way to do it but I do not yet know how*/: Adding data from spreadsheet to custom fields in Google Contacts with GAS

‘While’ loop with a ‘Sleep’ and ‘Toast’

Screenshot of toast notification in Google Sheet
Screenshot of toast notification in Google Sheet

Understanding how to use a simple ‘while’ loop that pops up a ‘toast’ message every 5 seconds by making use of ‘Utilities.sleep’ to pause the script.

This was created as part of some testing for another script designed to bulk move files between Google Drive folders. Without the toast notification it was difficult to determine the progress being made, so adding it in allowed for the name of the file last copied to be displayed to the user. This script removes all of the extra features and shows the basic while loop and toast.

Source: The Gift of Script: While loop with a Sleep and Toast

Clear cell contents on Google Sheet edit

Screenshot of coloured columns to highlight actions
Screenshot of coloured columns to highlight actions

This is designed to clear the adjacent cell to the right of the one that has just been edited – so long as it is within the column we specify.

It was developed as I was testing the available options for a Stock Inventory system where an item that was to be marked as back in stock would automatically clear an email timestamp in the adjacent cell (ready for the whole ordering process to start again).

Source: The Gift of Script: Clear cell content on Google Sheet edit

Create alphabetised folders in Google Drive

Screenshot of Google Drive folder layout

The script is designed to bulk create folders from a Google Sheet and to arrange them into alphabetised folders within Google Drive, by extracting the first letter of a user’s surname.

If a suitable alphabetised folder does not exist in Google Drive, then one is created. The script also adds the created folder to an ‘Everybody’ folder so that there is a single area with all the folders listed in.

Source: The Gift of Script: Create alphabetised folders in Google Drive

Bulk rename files in Google Drive

Screenshot of File renamer text fields

Screenshot of File renamer text fields

This is designed to automate bulk renaming of multiple files within a single Google Drive folder. It has been developed as a Google Sheet with flexibility towards entering your own search pattern and replacement string as you see fit.

Source: The Gift of Script: Bulk rename files in Google Drive

Bulk send emails from a Google Sheet

This is designed to loop through each row of a Google Sheet and send an email containing information from it. This means you can send personalised emails with ad-hoc information for each recipient quickly.

It has been developed so that it is easily expandable for you to add further columns/rows. The script has a number of features to achieve this:

  1. A menu option for easily selecting to send email, with a confirmation dialogue popup.
  2. A timestamp as confirmation for when an email was sent.
  3. A check that an Email Address is present and there is no current value in the Email Sent column – to prevent repeat email sending but also allow ad-hoc emailing by clearing this column for those you wish to send again.
  4. A try/catch to help automatically deal with problematic emails that may break the script – an error message will be written into the Email Sent column and the script will continue on to the next row.

Source: The Gift of Script: Bulk send emails from Google Sheet