AppsScriptPulse

Report: Implementing a pseudo 2FA for Web Apps using Google Apps Script

In Google Apps Script, there is the Web Apps. When Web Apps is used, the users can execute Google Apps Script using HTML and Javascript. This can be applied to various applications. When the Web Apps is deployed with “Anyone”, anyone can access the Web Apps. And, there is the case that Web Apps deployed with “Anyone” is required to be used. Under this condition, when 2 Factor Authentication (2FA) can be implemented, it is considered that the security can be higher and it leads to giving various directions for the applications using Web Apps. In this report, I would like to introduce the method for implementing the pseud 2FA for Web Apps deployed with “Anyone” using Google Apps Script.

There can be scenarios where you’d like to publish an Apps Script web app with ‘anyone can access’, but still provide a level of security. Here’s a nice example from Kanshi Tanaike where they use MailApp to email the user a a time limited random passcode.

Magic links and passwordless login are used by a number of services, including Slack, and rather than including a password, as demonstrated in this example, it wouldn’t take much to turn this solution into a passwordless app. There are risks associated with email based authentication and if an attacker already has access to your email so other solutions are worth considering depending on the sensitivity of your web app.

Source: Report: Implementing Pseudo 2FA for Web Apps utanaikech.github.iosing Google Apps Script

[Workaround] An alternate to displaying more than 100 widgets/sections in a Google Workspace Add-on

Working around the 100-widget limit in Card Services, used when building Workspace Add-ons.

Like it says on the tin a way to display more than 100 items in a Google Workspace Add-on. The solution also has a nice UX friendly search feature to make it easier to find stuff in the UI. The source post from Sourabh Choraria includes additional information and links to the code on GitHub.

Source: [Workaround] An alternate to displaying more than 100 widgets/sections.

Develop a Google Chat App Currency Converter with Google Apps Script – Yagisanatode

Have you ever wanted to convert currencies instantly while in Google Chat with colleagues and clients? In this tutorial, we are going to build a Currency Converter Google Chat App with Google Apps Script to do just that.

This tutorial is a multi-media series containing step-by-step video instructions for each stage of the process along with code snippets for each stage, important links and some further details on the more unusual parts of the code.

This is a great video series wrapped in a blog post, which highlights a Google Chat app development process. The particular project presented by Scott Donald is a currency converter but there are many repeatable aspects that would work in a wide range of Google Chat applications. The project is coded in Google Apps Script and the post includes plenty of snippets to help you understand various aspects of Google Chat app development including slash commands and information cards.

Source: Develop a Google Chat App Currency Converter with Google Apps Script – Yagisanatode

How to create a Trello card using Google Apps Script

If you are a Google Workspace and Trello power user like me, I’m sure the thought has come across your mind of connecting your Google Apps to Trello, but every time you search for a solution you get an ad for Zapier or IFTTT. I try to avoid these solutions because they are great at making an initial connection, but if you ever want to do anything advanced, it will require you to sign up for a premium subscription. After searching and not finding answers, I decided just to try and build it for myself.

If you are a beginner to Google Apps Script this is a nice tutorial if you are interested in learning about connecting with other services, in this case Trello. Hopefully this post also illustrates that coding aspect of connecting with other services using Google Apps Script can be straightforward once access had been setup on the third party site.

Source: How To Create a Trello Card from Apps Script

An automatic random team maker using Google Apps Script

In this post, we’re going to look at a script to be able to make even teams from a selection of players. I play football every Sunday and every week my friends sign up to play and most weeks there are different players playing, so we end up having to make the teams, and trying to do it as fairly as we can, which inevitably takes some time.

Nice ‘weekend project’ from Baz Roberts highlighting how Google Apps Script can be used to do a weighted random shuffle of data. The post includes a line-by-line explanation of what the script is doing and a great resource if you are at the beginning of your Apps Script journey.

Source: Automatic Team Maker — Apps Script (also available on bazroberts.com)

Efficient file management using batch requests with Google Apps Script 

Google Drive alone can handle small file management jobs, but for larger batches of files, it can be too much for a simple Drive script to manage. With Google Apps Script, even large batches can be executed within 6 minutes, offering businesses the monetary and time benefits of efficient file management. This report looks at how Google Apps Script improves file management with batch requests, judging its efficacy by measuring the benchmark.

We’ve regularly highlighted work from Kanshi Tanaike in Pulse and it’s nice to see it also being highlighted in the official Google Cloud Blog. I’m sure many Google Workspace developers, like me, have encountered issues with managing large volumes of Google Drive files. In the post Kanshi Tanaike highlights how batch methods can be used to greatly speed up the process when interacting with the Google Drive API.

Source: Efficient File Management using Batch Requests with Google Apps Script | Google Cloud Blog

AppSheet/PayPal integrated payment solutions and tips on handling data in Google Sheets

In this post I’ll provide an overview of how PayPal was integrated into AppSheet with the help of Google Apps Script. Even if you are not interested in payment integrations this post also hopefully pulls together useful tips, best practices and code patterns for reading/writing data to Google Sheets.

Hopefully this post illustrates not only just a method for integrating a PayPal payment processor into an AppSheet app, but also a method which can generally be used to extend AppSheet functionality with Google Apps Script powered Web Apps.

As a bonus you also get some of my top tips for interacting with data in Google Sheets including efficiently reading/writing data for multiple users without concurrent overwrites.

Source: AppSheet/PayPal integrated payment solutions and tips on handling data in Google Sheets

📮`MMailApp` for Google Apps Script: GmailApp+MailApp+Gmail API

The library lets you send emails, using MailApp, GmailApp, and Gmail API. The library takes care of parameters, so you do not need to care about which method to use. I had trouble with my project when I wanted to automatically send emails and suddenly for me we’ve reached the daily limit. This is why I’ve decided to make some research and be sure fewer bad things happen in the future.

If you are looking for a deep dive into Google Apps Script powered email sending options you are at the door of enlightenment. In this post from Max Makrov you not only to get an explanation of the options and benefits for sending email with MailApp, GmailApp and the Gmail API, but also a handy library, MmailApp. which makes it easy to switch between all three.

Source: 📮`MMailApp` for Google Apps Script: GmailApp+MailApp+Gmail API

Using OCR to convert large images to Google Docs with Google Apps Script (avoiding Request Too Large error)

When the image size, the image file size, the resolution of the image, and so on are large, an error like Request Too Large occurs. In this sample script, such the image can be converted to Google Document by reducing them.

Here is a workaround for converting large images to Google Docs from Kanshi Tanaike. The post includes a code snippet and link to related Stack Overflow Q&A. As noted in the SO discussion the solution might be a compromise for some developers as it reduces the image resolution being passed into Google Drive and if you need to keep the original quality you might have to look at other paid services.

Source: Converting Large images to Google Document by OCR using Google Apps Script

Duplicate Filter Views in selected Google Sheet tabs with Google Apps Script

While there is not way to directly duplicate Filter Views into other sheet tabs in Google Sheets we can do this with a little bit of Google Apps Script magic.

In this tutorial, we will walk through how to duplicate all filter views from a source Google Sheets tab and duplicate them into selected sheets tab.

We’ll start off with an example sheet to better understand what we are going to achieve and then share the code along with a quick-use guide for those of you who want to to just get in and use the script in your own project.

This tutorial from Scott Donald is a great opportunity to learn more about manipulating Filtered Views in Google Sheets and as a bonus you may pick up some tips on how to use the Sheets Advanced Service.

Source: Duplicate Filter Views in Selected Google Sheet Tabs with Google Apps Script – Yagisanatode