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.
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.
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.
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.
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.
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.
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).
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
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.
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…