Tuesday 13 February 2024

Replace text in a Google Doc with an image

The following Google Apps Script is designed to search the body of a Google Doc for a specific string/pattern (i.e. a keyword) and insert an image in place of it, optionally making it a clickable hyperlink too.


Instructions

In this example the code is designed to sit behind the Google Doc so it is bound to it. There are 4 pieces of information to complete in order to setup the script:

  1. searchText - this is the unique string/pattern in the Doc that you want to replace with an image e.g. "<<keyword>>"

  2. imageURL - this is the direct link to the image in Google Drive that you wish to use in the Doc.

  3. size - a numerical value representing the number of pixels for the image's width/height.

  4. hyperlinkURL - if you want the image to be clickable then provide a link for it.

Tuesday 23 January 2024

Google Add-on: Auto Close Form


What it does

The Add-on allows you to have a Google Form automatically close when a set number of responses has been reached or on a specific date. You define exactly how many responses or the date, per form, and then leave it to run in the background. Once a Form has closed you will receive an automated email informing you.

Example uses:

  • Sign ups to an event/workshop/conference.
  • A limited time offer.
  • Submission deadlines.


Find out more

Auto Close Form Add-on webpage - includes instructions and demo videos.

Tuesday 16 January 2024

Drive API - get file information

The following Google Apps Script is a snippet of code where I was learning how to use the Drive API to query a folder of files, to extract some specific file information. It is designed to work on both My/Shared drives.


Information to Extract

  • Name;
  • Type (e.g. Doc, Sheet);
  • ID;
  • Creation date;
  • Last modified date;
  • Clickable link;
  • Owners


Enable Drive API

Please follow the steps to enable the 'Drive API' Service if you are not working from a copy of the file in this post.

Tuesday 9 January 2024

Google Add-on: Form Calendar Invites


What it does

The Add-on allows you to link a Google Form™ with Google Calendar™ events so that when people complete the Form and select a particular title/date/time from it, they are sent an automated email invite to one of the respective Calendar events.

This allows you to have Calendar events with all guests attached to it such as for conferences, workshops, drop-ins, training sessions, etc. Therefore any changes to an event (description/conferencing, etc) will be reflected for all guests - just like any other event.

Sessions listed in the Form can be selected

Find out more

Form Calendar Invites Add-on webpage - includes instructions and demo videos.

Tuesday 12 December 2023

Google Add-on: Convert Drive Files update December 2023

 

What it does

Bulk convert Google Drive™ files quickly and easily with this Add-on. Convert between Google™, Microsoft Office™, OpenDocument, PDF, etc. Point the Add-on at a Google Drive™ folder, select the file types you want to convert, select your destination folder and whether you want the original file to be deleted, then hit go! Saves having to go into each file individually, selecting the file type to download and then selecting the save destination.


Update

  • Remove original file extension option
    • Based on feedback, the default behaviour for automatically removing any existing file extension has been stopped. There is now a simple Yes/No option allowing you to choose for yourself exactly what you want to happen. The main reason for this change was due to file names containing 'full stops' that would otherwise be lost as the tool treat them as part of the extension.

 

Find out more

Convert Drive Files Add-on webpage - includes instructions and demo videos.

Tuesday 5 December 2023

Check for existing Form Submit Triggers

The following Google Apps Script is designed to check existing user triggers of a Google Sheet for any onFormSubmit triggers. Any that are found are then deleted and a new onFormSubmit trigger is created.

Check existing user triggers of a Google Sheet
Check existing user triggers of a Google Sheet

Tuesday 14 November 2023

Google Add-on: Bulk Rename Files/Folders update November 2023


What it does

Bulk rename Google Drive™ files/folders quickly and easily with this Add-on. You define exactly what you want to search for in the file/folder name and the text to replace it with. Along with options for handling special characters and append/prepend to the existing file/folder name. Works across My/Shared drives.


Update

 

Find out more

Bulk Rename Files Add-on webpage - includes instructions and demo videos.

Tuesday 7 November 2023

Control Form submissions with Script Lock

The following Google Apps Script is one example of how the Lock Service can be used to prevent concurrent running of code. Here we have a Google Form that can be submitted by users at any point, the code then takes some of those details and appends them to another Google Sheet row. In normal circumstances this will happen relatively quickly and without clashes, but what if multiple people submit the Form at the same time!?

The likelihood is that whilst the Form data will still be collected correctly in the response sheet, the append Sheet will either overwrite data as it tries to keep up or miss it completely. By using the Lock Service we can allow each Form submission time to complete its bit of code before the next one starts.

Lock Service code snippet
Lock Service code snippet