5 CODING Exercises Google Apps Script Exercises Explore what you can do with Google Apps Script in Workspace

5 CODING Exercises Google Apps Script Exercises Explore what you can do with Google Apps Script in Workspace 1. Custom Email Campaign Manager Objective: Create a script that fetches contacts from a Google Sheets document, creates personalized emails based on a template, and sends them at scheduled intervals. Include functionality to track which contacts have already … Read more

How to Split your Google Doc into separate new Docs separate with H3

Automating Google Docs Management with Apps Script: Splitting Documents by Headings In today’s fast-paced digital environment, efficiency and automation are key to handling documents and data. Google Apps Script offers a powerful way to automate tasks within Google Workspace, including Docs, Sheets, and more. One common task is the management of large documents, particularly when … Read more

Google Apps Script that removes blank lines from a Google Doc

Google Apps Script that removes blank lines from a Google Doc, you can use the following script. This script iterates through all the paragraphs in the document and checks if any of them are empty (i.e., contain only whitespace characters or nothing at all). If an empty paragraph is found, it is removed from the … Read more

Google Apps Script that inserts page breaks in a Google Doc just before each H3 element

Google Apps Script that inserts page breaks in a Google Doc just before each H3 element, you can follow this approach. This script iterates through the document’s elements, identifies H3 headings, and inserts page breaks immediately before each H3 element. How to Use This Script: This script checks each paragraph to determine if it’s styled … Read more

Create new element from list item with specific text in it Google Apps Script in Docs

To modify the script to add each “Answer” item as a new line immediately following where it was removed, rather than at the end of the document, we need to adjust the logic to insert a paragraph right after the detected list item’s position. Here’s how you can do it: This script differs from the … Read more

Write a simple script to log a custom message in the Google Apps Script log

Write a simple script to log a custom message in the Google Apps Script log Instructions: Explanation: This script defines a function logMessage that creates a variable message containing a string. It then uses Logger.log() to print this message to the Google Apps Script log. function logMessage() {  const myName = ‘Laurence’;  const message = … Read more

Append a row of data to the end of the current sheet

Append a row of data to the end of the current sheet Instructions: Explanation: This script appends a new row to the bottom of the active sheet with the data provided in the rowData array. function appendMyRow(){   const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(‘Sheet1’);   const rowData = [‘New’,’Laurence’,’Svekis’];   sheet.appendRow(rowData);   //Logger.log(sheet.getName()); } Google Apps Script code snippet appends a … Read more

Use Google Apps Script to send an email to a specific recipient.

Objective: Use Google Apps Script to send an email to a specific recipient. Instructions: Explanation: This script uses the MailApp.sendEmail() method to send an email. It requires the recipient’s email address, the subject of the email, and the body of the email as parameters. Code: function sendMyEmail(){   const recipient = “email@gmail.com”;   const subject = ‘Test … Read more

Programmatically create a new Google Doc and insert text into it

Programmatically create a new Google Doc and insert text into it Instructions: Explanation: This script creates a new Google Doc titled “New Google Doc” and then inserts a paragraph of text into the document. Code: function createGoogleDoc(){   const paraContents = ‘My Name is Laurence Svekis’;   const doc = DocumentApp.create(‘New Google Doc’);   const body = doc.getBody(); … Read more