Posts

Showing posts from November, 2021

How to Get the Permanent URL of an Email Message in Gmail with Apps Script

Image
All email messages in your Gmail inbox have a permanent web address and you can add this URL to your bookmarks to quickly access that message in the future. You can save these message links in your task list or your meeting notes as they provide important context to the conversation. The URL of any email message is Gmail follows a standard format: https://mail.google.com/mail/u/<<UserId>>/#label/<<Label>>/<<UniqueId>> The UserId is the sequential ID of the currently-logged Gmail account (default is 0 ). The Label is the name of the Gmail label that the message is in (or use all ). The UniqueId is a unique ID that Gmail assigns to each message. The key here is the UniqueId that is internally assigned by Gmail. Get Gmail Message Links with Google Apps Script When you send an email with Google Apps Script, the Gmail API returns a unique ID that you can use to determine the URL of the email message in your sent items. Here’s a simple pr

How to Import Lodash in your JavaScript Projects for Lowest Bundle Size

Lodash is an extremely popular JavaScript library that provides a lot of useful functions for working with strings, arrays and objects in your web projects . Some of the Lodash functions are now supported natively in modern JavaScript, but the library still adds value and saves you time. For instance, if you want to generate a random number between 1 and 10, the _.random(1, 10) function is a great way to do it, similar to the RANDBETWEEN function of Google Sheets . The _.shuffle() function can help you quickly shuffle an array of values. The Correct Way to Include Lodash If your JavaScript project requires Lodash, you can include the library in your code in 4 different ways. 1. Import the entire lodash library import _ from "lodash" ; const capitalizeFirstName = ( name ) => { const result = _ . capitalize ( name ) ; console . log ( response ) ; } ; 2. Import using named aliases import { capitalize } from "lodash" ; con