AppsScriptPulse

How to Print the Function Call Flow with Stack Trace in JavaScript/Google Apps Script – Digital Inspiration

The printStackTrace method of Java is useful for handling exceptions and errors during development. It tells you the exact line number in your source code and the file name where the problem occurred.

If you are working in the JavaScript / Google Apps Script world, you can use the console.trace() method to output the complete stack inside the web console ( or StackDriver logs for Google Scripts).

A better alternative is that you parse the stack property of the Error object. This contains the entire stack trace along with line numbers, column position and the function names.

Great debugging tip from Amit that you can use in Google Apps Script for parsing the entire stack trace along with line numbers, column position and the function names. Check the source link below for example code and usage.

Source: How to Print the Function Call Flow with Stack Trace in JavaScript – Digital Inspiration

How to Unsubscribe from Mailing Lists and Junk Newsletters in Gmail with Google Apps Script – Digital Inspiration

Christian Heilmann’s tweet – Feature request for Gmail: automatically find and follow the unsubscribe link in all highlighted emails – prompted me to build an automated system for unsubscribing your Gmail address from the bulk senders. Here’s how it looks…

This is an older example from Amit Labnol that recently pinged my Google Alerts from this Best Unroll.me Alternatives post. The source post from Amit has some nice details about how marketing emails are marked up and the code shared might be a nice starter for your own solution.

Source: How to Unsubscribe from Mailing Lists and Junk Newsletters in Gmail – Digital Inspiration

YouTube Email Alerts – Monitor Videos around your favorite Topics [using Google Apps Script] – Digital Inspiration

Learn how to setup email alerts for YouTube videos and get daily automatically notification when new videos are uploaded that match your search topics.

Very slick example from Amit Agarwal and for the more advanced Google Apps Script developer well worth checking out the source code to see how Amit handles setting up and managing script triggers.

Source: YouTube Email Alerts – Monitor Videos around your favorite Topics – Digital Inspiration

Download Gmail Messages as EML Files in Google Drive – Digital Inspiration

This Google Script will help you download your email messages from Gmail to your Google Drive in the EML format.

Nice little snippet from Amit Agarwal for generating .eml files from Gmail messages using Google Apps Script. The post has all the code you need for this.

Source: Download Gmail Messages as EML Files in Google Drive – Digital Inspiration

How to Move Files Uploads from Google Forms to a Specific Folder in Google Drive – Digital Inspiration

The File Upload feature of Google Forms lets you receive files from form respondents directly in your Google Drive. You may add the File Upload question in your Google Form to receive PDF assignments from students, résumé applications, portfolio images from contestants, and so on.

When a respondent uploads a file through Google Forms, the file are stored in a fixed folder of your Google Drive. All files are uploaded in the same folder and, thus looking at the file in your Google Drive, it is difficult to determine which respondent has uploaded which set of files.

Learn how to organize file uploads and attachments from Google Forms and move files to a specific folder in Google Drive.

Source: How to Move Files Uploads from Google Forms to a Specific Folder in Google Drive – Digital Inspiration

How to Share User Properties between Google Apps Script Projects – Digital Inspiration

The Properties Service of Google Apps Script is used by developers to store app configuration and user specific settings. The properties data is scoped to a specific user, or a specific project, and cannot be shared between different projects. … In some specific cases, we may want to give access to our store data to another user so they may build upon the existing configuration rather than having to build everything from scratch.

Amit Agarwal shares a useful snippet for letting users export and import data from PropertiesService. There are some nice touches in this solution including using the JavaScript File Reader API.

Source: How to Share User Properties between Google Apps Script Projects – Digital Inspiration

How to Create JSON Web Token (JWT) with Google Apps Script – Digital Inspiration

You can use Google Script to create JSON Web Tokens (JWT) that can be provided to secure routes so that only authenticated requests that contain a valid token can connect to the APIs (e.g., the Zoom API)

Nice little snippet from Amit Agarwal for both creating and decoding JSON Web Tokens (JWT).

Source: How to Create JSON Web Token (JWT) with Google Apps Script – Digital Inspiration

Google Drive Monitor – Get Email Alerts When Files are Deleted in your Drive with Google Apps Script – Digital Inspiration

Monitor your Google Drive automatically and get email alerts when important files and folders are deleted from your Google Drive. You can also watch file activity in Shared Drives

Source: Google Drive Monitor – Get Email Alerts When Files are Deleted in your Drive – Digital Inspiration

How to Make your Documents Read-only in Google Drive using Google Apps Script – Digital Inspiration

Your documents and files in Google Drive can be modified by anyone who has edit access to the file. You can always remove external collaborators from your documents to prevent them from editing your files but how do you prevent yourself (the owner) from accidentally editing your own files in Google Drive? Google Drive doesn’t have a simple button (yet) for locking files so here’s a little Google Script that can help you make any file in your Google Drive read-only.

Nice post from Amit Agarwal showing how the new Google Drive Locking API can be used with Google Apps Script. The post contains all the code and instructions you need to get started.

Source: How to Make your Documents Read-only in Google Drive – Digital Inspiration

Send Rich Text HTML Emails with Google Sheet – Digital Inspiration

You can format the source data in Google Spreadsheet in different colors, fonts and sizes and all your cell formatting will be retained in the email messages.

Very handy code snippet from Amit Agarwal which lets you convert the formatted text in a Google Sheets cell to HTML. In the example Amit uses the formatted text in an email sent with MailApp but you might find other uses for this solution. Click through to the source link for all the details…

Source: How to Preserve Formatting of Spreadsheet Cells in Mail Merge – Digital Inspiration