AppsScriptPulse

Google Apps Script Tutorial: Letterhead in Google Docs

In this Google Apps Script tutorial you will learn how to automatically create a letterhead in Google Docs.

This is a nice short video tutorial from Chanel Greco highlighting how you can manipulate a Google Doc header using Google Apps Script.

Get the redirect location of a URL using Google Apps Script

Have a list of shortened urls and need their final destination? Use this custom function in google sheets to extract them all at once.

Handy little snippet that can make testing redirects on URLs a lot easier, which can be useful for expanding short links from social media sites like Twitter.

Source: get the redirect location of a url using google apps script

How to Convert HTML to PDF with Google Script – Digital Inspiration

With Google Apps Script, you can easily convert any HTML content into a PDF file. The converted PDF file can be either saved to a folder in your Google Drive, you can email the file as an attachment or the use the UrlFetchApp service of Apps Script to post the PDF file to an external service like Amazon S3 or Dropbox.

Source: How to Convert HTML to PDF with Google Script – Digital Inspiration

How to Build Custom Functions in Google Sheets with Google Apps Script

Build your own functions in Google Sheets that do anything you need them to in a few lines of code.

This is a great tutorial if you are interested in finding out more about developing custom functions in Google Sheets. The post includes everything you need to get started from handling single cell and range inputs, to documenting your function so that users see inline help.

Source: How to Build Custom Functions in Google Sheets with Google Apps Script

Send data to a Google Form via Apps Script

Use Google Apps Script to create a prefilled URL of data that can be submitted to a Google Form.

Screenshot of Google Form questions

Screenshot of Google Form questions

The following Google Apps Script is designed to submit specific data to a Google Form, by creating a prefilled URL. The reason for this was I needed some way of sending data from a number of individual Google Sheets (that I did not own) to one central location, but crucially it needed to be anonymised.

Sending the data directly to a Google Sheet includes version history both in the file and cell meaning it was not truly anonymous. Whereas sending the data through a Google Form and then on to the Response Sheet did strip away anything identifiable.

The logic behind this code is to create a prefilled URL which contains answers to each of the Forms questions. Use the previous webpage link to learn how to create such a URL first so that you understand each question on a Form has a unique value.

Source: The Gift of Script: Send data to a Google Form via Apps Script

Visually code Google Apps Script with Teacher Blocks

This is a quick discussion of how teacher can respond to student work using block based coding.

This is a very interesting prototype which makes it easier for users to visually develop Google Apps Script code. Developed by Stephen Callahan as part of a Google Innovator Project, TeacherBlocks lets to drag and drop blocks to design your code and automatically create the required script to copy/paste into your Google Doc. Watch the video to see it in action or visit the source link to try it yourself.

Source: Teacher Blocks 

Search Google Drive files and extract row data

Search and extract the content of Google Drive files. Collate the row data into a collective Google Sheet.

Search and extract the content of Google Drive files

Search and extract the content of Google Drive files

This was created for a specific Subject Access Request but may be of interest/use to others.

Source: The Gift of Script: Search Google Drive files and extract row data

Tracking Google Sheet Opens with Google Apps Script

The basic principle behind tracking Google Sheet opens is the same as the one behind email tracking with a transparent pixel. In a Google Sheet, we will use the IMAGE()function, which will call a deployed Google Apps Script web app URL with some parameters in the query string. The web app will be able to do whatever you need among the following: record to a spreadsheet, create a message via a messenger, or simply send an email.

Source: Tracking Google Sheet Opens with Google Apps Script

How to Automatically Archive Gmail Messages and update your Gmail signature with Google Apps Script

Chanel Greco at saperis has shared some useful video tutorials that should help beginner Google Apps Script developers with working with Gmail:

In this Google Apps Script tutorial we will learn how to automatically archive Gmail messages.

In this video tutorial you will learn how to create an email signature in Gmail.

Check the domain of an email address by regex

Compare a number of email addresses and check their domains against one you are filtering for via a regular expression.

Screenshot of email addresses in a Google Sheet cell

Screenshot of email addresses in a Google Sheet cell

The following Google Apps Script is designed to use a regular expression (regex) to confirm if an email address domain matches one we specify eg: @hotmail.co.uk, @gmail.com, @outlook.com

I developed the code so I could screen email addresses to make sure they only came from within the institution – otherwise it would have broken the tool I was developing for creating Zoom meetings. The email addresses in this example are all stored in one cell in a Google Sheet and are separated via a comma and a single space.

Source: The Gift of Script: Check the domain of an email address by regex