AppsScriptPulse

How to Create Dynamic Open Graph Images with Google Sheets [and Google Apps Script] – Digital Inspiration

Generate dynamic Open Graph images for your website with Google Sheets without requiring Puppeteer. All pages on your website can have their own unique Open Graph images created from a Google Slides template.

As explained by Amit Agarwal Open Graph images are included as a feature image on social media sites when the link is shared. You can use static images but some sites like Github dynamically create an image that includes additional information.

For example, if you were to share the link to the Google Workspace Solutions Github repo on Twitter an image is automictically displayed containing information like the number of contributors, issues, stars and forks:

Google Solutions - Open Graph from Github

To generate these images often a headless browser solution like Puppeteer is used. In this example from Amit he shows how a Google Slides template and a little Google Apps Script can be used to batch create similar open graph images.

Source: How to Create Dynamic Open Graph Images with Google Sheets – Digital Inspiration

How to Request Stripe Payments with Google Sheets – Digital Inspiration

Image credit: Amit Agarwal

How to use Google Sheets to generate Stripe payment links and request payments in any currency from your customers anywhere in the world!

Amit Agarwal continues an excellent series of payment themed posts with this latest contribution on integrating the new Stripe Payment Links API with Google Sheets. As noted by Amit this can be combined to make quick payment workflows. Click through for more details and the source code.

Source: How to Request Stripe Payments with Google Sheets – Digital Inspiration

Make an RSS Feed with Google Apps Script – Digital Inspiration

RSS flickr photo by Lars Plougmann shared under a Creative Commons (BY-SA) license

ThinkAmI uses the XMLService of Google Apps Script to create a valid RSS feed that is served to the browser using ContentService with the MIME type set as RSS.

Recently I was looking for a Google Apps Script snippet to create a RSS data feed. Back in the day Apps Script used to have a Xml.parseJS() method which could make a data feed from a JavaScript array. It was announced that the old XML service would be replaced by XmlService in 2013 so we are not talking breaking news here.

The RSS helper script created by ThinkAml and shared by Amit Agarwal makes it a lot easier to generate a feed in a couple of lines of code. To let you see I’ve included a snippet and click through to the source post for the full code:

    var rss = makeRss();

    rss.setTitle('RSS 2.0 Feed with Google Apps Script');
    rss.setLink('http://example.com');
    rss.setDescription('RSS 2.0 Feed');
    rss.setLanguage('en');
    rss.setAtomlink('http://example.com/rss');

    for (var i = 1; i < 3; i++) {
        rss.addItem({
            title: 'TITLE:' + i,
            link: 'http://example.com/#' + i,
            description: 'DESCRIPTION: ' + i,
            pubDate: new Date()
        })
    }

Source: Make an RSS Feed with Google Apps Script – Digital Inspiration

How to Share Files in Google Drive with Multiple Users using Google Apps Script – Digital Inspiration

Google Drive Access Screen

A limitation of the Drive API is that you can only share files with one user at a time. Google Apps Script is synchronous – it doesn’t support the async/await pattern of JavaScript Promises and you therefore cannot run the code in parallel.

There’s however a simple workaround to help you share a file or folder in Google Drive with multiple users in one go in parallel using the UrlFetchApp service.

On Pulse Phil recently shared a snippet for changing a Google Drive file permissions from Editor to Viewer. In this example for Amit Agarwal you can see how you can make these types of changes for multiple users without slowing down your script execution time.

Source: How to Share Files in Google Drive with Multiple Users – Digital Inspiration

How to Delete Blank Rows from Tables in Google Documents – Digital Inspiration

How to remove all blank rows from one or more tables in a Google Docs document with Google Apps Script. You may also delete blank rows from tables in Google Slides.

Source: How to Delete Blank Rows from Tables in your Google Documents – Digital Inspiration

Improve Performance of Google Apps Script with Memoization – Digital Inspiration

How to use JavaScript memoization to optimize and improve the performance of your Google Apps Script code. … Memoization is a simple optimization technique that can be used to improve the performance of your Google Apps Script code. The basic idea is that you cache the results of an expensive function call using closures. If the function is called again with the same arguments, the cached result is returned instead of calling and executing the function all over again.

Great tip from Amit Agarwal for improving the performance of data heavy functions. Follow the link to the source post to find out more and a code sample to get started that finds a particular value in a CSV file.

Source: Improve Performance of Google Apps Script with Memoization – Digital Inspiration

How to Request Payments with Stripe Checkout and Google Sheets – Digital Inspiration

How to use Google Sheets to generate Stripe payment links and request payments in any currency from customers anywhere in the world!

We’ve previously featured Amit Agarwal’s Razorpay and Google Sheets payment solution. This latest example from Amit highlights how to integrate Stripe payments with Google Sheets. The source post contains the code you’ll need, how to setup and also automation options.

Source: How to Request Payments with Stripe Checkout and Google Sheets – Digital Inspiration

How to Request Payments with Razorpay and Google Sheets – Digital Inspiration

How to use Google Sheets to generate Razorpay payment links and easily accept payments from customers anywhere in the world!

Razorpay is a popular payment gateway in India that allows you to accept online payments from customers anywhere in the world. Your customers can pay with credit cards, debit cards, Google Pay, Walmart’s PhonePe and other UPI apps.

A great solution from Amit Agarwal for creating payment links in Google Sheets for Razorpay. The source post provides more details of how this works and setup required. The post also outlines how you can combine this with a mail merge to sort all your invoicing needs.

Source: How to Request Payments with Razorpay and Google Sheets – Digital Inspiration

How to Convert HTML to PDF with Google Script – Digital Inspiration

With Google Apps Script, you can easily convert any HTML content into a PDF file. The converted PDF file can be either saved to a folder in your Google Drive, you can email the file as an attachment or the use the UrlFetchApp service of Apps Script to post the PDF file to an external service like Amazon S3 or Dropbox.

Source: How to Convert HTML to PDF with Google Script – Digital Inspiration

How to Create a Telegram Bot for Sending Notifications using Google Apps Script – Digital Inspiration

Learn how to create your own Telegram bot with Google Apps Script and post notification messages from Google Sheets, Forms and other Google apps.

We’ve a couple of Telegram bot posts already shared in Pulse. The latest come from Amit Agarwal who shares his insight, highlighting some particularly useful functionality and use cases. More details in the source link.

Source: How to Create a Telegram Bot for Sending Notifications using Google Apps Script – Digital Inspiration