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

Read and log data from the first cell in a Google Sheets spreadsheet

Objective: Read and log data from the first cell in a Google Sheets spreadsheet. Code: function readSpreadsheetData() {   const ss = SpreadsheetApp.getActiveSpreadsheet()   const sheet = ss.getSheetByName(‘Sheet1’);   const range = sheet.getRange(‘A1’);   const value = range.getValue();   Logger.log(value); } Instructions: Explanation: This script gets the active sheet of the current spreadsheet, accesses cell A1, reads its value, and … Read more

50 Exercises 55 Quiz Questions Getting started with Google Apps Script

Check out our comprehensive guide on “Getting Started with Google Apps Script If you’re looking to level up your Google Apps Script skills, this guide is a must-read. It covers 50 Exercises and 55 Quiz Questions to help you become a scripting pro. 🤓 🔥 Here are some key objectives covered in the guide: #GoogleAppsScript … Read more

Update Docs page elements update finding a H3 and combine it with the next paragraph

Here’s a breakdown of how the code works: In summary, this script is designed to find Heading 3 paragraphs in the document, take the content of the next paragraph, and replace the content of the Heading 3 paragraph with it, effectively merging the two paragraphs while removing the original next paragraph.

Adjust line indentation with apps script in Docs

To adjust the indentation of list items properly in a Google Document using Apps Script, it’s essential to use the correct properties and methods. Unfortunately, the setIndentStart and setIndentFirstLine methods I mentioned earlier do not exist in the Google Apps Script Document service. For list items, you can adjust the indentation level via the setGlyphType … Read more

Format List items with Apps Script

Google Apps Script that finds list items in a Google Document, resets their formatting to mimic “Normal” text style while maintaining them as list items (but without bullet or numbering formatting), and ensures they are properly indented, you can follow these steps. Since Google Docs inherently treats list items differently from normal text, direct conversion … Read more

Google Apps Script that updates the format of list items in a Google Document to the default format

Google Apps Script that updates the format of list items in a Google Document to the default format, you can use the following approach. This script will iterate through all elements in the document, identify list items, and apply default formatting to them. “Default formatting” can vary based on your requirements, but for the sake … Read more

Apps Script to remove bullet format from Doc

Google Apps Script to remove bullet formatting from list items in a Google Document, you need to modify the script to not only reset the formatting of the list items but also to convert them into regular text paragraphs. Here’s how you can adjust the previously provided script: This script goes through each element in … Read more