Friday, 27 September 2019

Bulk send emails from Google Sheet

The following Google Apps Script 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.
Screenshot of spreadsheet data used for creating emails
Screenshot of spreadsheet data used for creating emails

Thursday, 26 September 2019

Search Google Calendar date range for specific events

The following Google Apps Script builds on this previous post for searching Google Calendar for event details by expanding the search scope to a date range and including search criteria to narrow down the results.

There are only a couple of extra lines to add since we did most of the work in the previous blog post.
var options = {search: 'Test'};
var allEvents = calendar.getEvents(startDate, endDate, options);
So this time we can specify further criteria when getting events - like searching for the text Test and providing a start/end date.

Sunday, 15 September 2019

Remove HTML tags in a cell by a regex

The following Google Apps Script is designed to remove all HTML tags within the content of a cell by using a regular expression (regex). It was developed as a more advanced version of this HTML email body blog post in that it could dynamically remove various instances of HTML tags used (eg <font></font>, <br />, <strong></strong>) all in one go.
Screenshot of cell containing HTML tags and text
Screenshot of cell containing HTML tags and text

The regex uses 'replace' to identify the HTML tags and remove then (or technically replace them with nothing):
var cleanContent = cell.replace(/<[^>]+>/mg,"");

Saturday, 14 September 2019

Split single cell contents with new line

The following Google Apps Script is designed to separate the contents of a cell that have been entered on a new line (by pressing Alt + Enter in Windows). In this example there are 3 email addresses in the one cell that we want to 'split' up so we can extract each one individually.
Screenshot of cell with content added via a new line
Screenshot of cell with content added via a new line

Saturday, 7 September 2019

Bulk rename files in Google Drive

As of February 2022 this tool is now available as a Google Workspace Marketplace Add-on.

The following Google Apps Script 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.

Download
Bulk rename files in Google Drive download (please use 'File' > 'Make a copy' for your own version).
As of February 2022 this is now available as a Google Workspace Marketplace Add-on.