Trend of the google-apps-script tag on Stack Overflow for 2021. Apps Script usage in decline?

Stack Overflow is a question and answer website for professional and enthusiast programmers. It is the flagship site of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky. It features questions and answers on a wide range of topics in computer programming.


Kanshi Tanaike has recently published the 4th annual Stack Overflow trend report for the Google Apps Script question tag. The full report, including how the data is collected, is published here and there is some further discussion on the Google Apps Script Google Group community.

From the headline data it is interesting to see the total number of Google Apps Script questions posted on Stack Overflow has declined following previous years of continued growth. It’s important to remember that this decline is unlikely to directly correlated with general App Script usage. Factors that might be influencing the number of questions asked include like better developer documentation, larger corpus of existing Stack Overflow answers, growing number of other community resources and spaces.

Fig. 1. Year vs. Total questions, answered, solved and closed questions. These all questions include the tag of “google-apps-script” in the tags. Image credit: Kanshi Tanaike

Another consideration is Google Apps Script is increasingly positioned as a platform for citizen developers and low coders. This community may be more hesitant to ask questions on a site that has a reputation as being for ‘professional programmers’. My conclusion is the annual Stack Overflow report for Google Apps Script is always very useful to see, particularly in terms of see if there are enough people answering questions.

Finally, as a little easter egg here is a Google Sheet I’ve created which includes a little Apps Script to fetch my own Stack Overflow annual report data. Copy and open the script editor to add a monthly trigger to get the data. Next year I’m planning to look at changes in post viewcount :)

r/GMail – Has anybody here tried to improve Martin Hawksey’s free Mail Merge system? [adding custom attachments to mailing]

Has anybody here tried to improve Martin Hawksey’s free Mail Merge system? from GMail

I’m not really a reddit user but this question about adding custom attachments my Google Workspace Solutions Gallery – Mail Merge example landed in my inbox. The solution is, in Google Apps Script tradition, one line of code! The line is:

if(row['Attachment'] != '') emailTemplate.attachments.push(DriveApp.getFileById(row['Attachment']).getBlob());

The logic is:

  1. check if the row value in the column named Attachment
  2. if true call Drive to open file with attachment id and push to the emailTemplate object.

The line is added just after:

const msgObj = fillInTemplateFromObject_(emailTemplate.message, row);

If you prefer you can also copy this sheet for a working example. To attach different files the Attachment row cell needs to include a Google Drive file id. There are a number of ways you can get Drive file id’s. For example, here is a Getting all files’ file-id from a folder in Google Drive snippet.

If you are interested in more of what is happening in this solution, the emailTemplate object is returned by getGmailTemplateFromDrafts_() . This function gets the Gmail draft message and as well as any attachments including inline images. If you are interested in handling attachments and inline images you can read more in Everything you ever wanted to know about Gmail draft inline images and Google Apps Script but were afraid to ask.

How to get Google Lighthouse reports using PageSpeedInsights API and Google Apps Script


Image: CC-BY Google

Lighthouse is an open-source, automated tool for improving the quality of web pages. You can run it against any web page, public or requiring authentication. It has audits for performance, accessibility, progressive web apps, SEO and more.

On StackOverflow there is a nice question/answer from Mert Dökümcü on How to send Google Lighthouse reports to Slack using PageSpeedInsights API and Google Apps Script. You can read the full solution there and below is an excerpt from Mert’s post (copied here CC-BY-SA Mert Dökümcü) of the bit that really interested me, getting results from PageSpeedInsights .

First and foremost, get…

Once you have these, go to and create a new script. The following code should do the trick:

var mobileData = fetchDataFromPSI('mobile');
var desktopData = fetchDataFromPSI('desktop');
function pageSpeedApiEndpointUrl(strategy) {
const apiBaseUrl = '';
const websiteHomepageUrl = ''; // Your website
const apikey = ''; // Your API key
const apiEndpointUrl = apiBaseUrl + '?url=' + websiteHomepageUrl + '&key=' + apikey + '&strategy=' + strategy;
return apiEndpointUrl;
function fetchDataFromPSI(strategy) {
const pageSpeedEndpointUrl = pageSpeedApiEndpointUrl(strategy);
const response = UrlFetchApp.fetch(pageSpeedEndpointUrl);
const json = response.getContentText();
const parsedJson = JSON.parse(json);
const lighthouse = parsedJson['lighthouseResult']
const originLoadingExperience = parsedJson['originLoadingExperience']
const result = {
'overall_performance': originLoadingExperience['overall_category'],
'score': lighthouse['categories']['performance']['score']*100,
'firstContentfulPaint': lighthouse['audits']['first-contentful-paint']['displayValue'],
'speedIndex': lighthouse['audits']['speed-index']['displayValue'],
'timeToInteractive': lighthouse['audits']['interactive']['displayValue'],
'firstMeaningfulPaint': lighthouse['audits']['first-meaningful-paint']['displayValue'],
return result; 

Structure and simplify your Google Apps Script (with) V8

Apps Script now supports the V8 runtime. Time for an update to the story “Structure and simplify your Google Apps Script Apps script”. The V8 runtime brings modern ECMAScript syntax to Apps Script. So we can now use arrow functions and destructuring assignments. No more hoisting with let and const and my personal favorite, template literals.

In this story Jasper Duizendstra shows the added value of the changes made in the constructor pattern using the factory functions. It also shows how to implement chaining and a builder pattern in Apps Script.

Source: Structure and simplify your Google Apps Script (with) V8

Reliable, Secure & Scalable use of Google Apps Script | Google Developers Experts

Most conversations around solutions or automations created using Apps Script eventually get to a point where being able to address concerns around its reliability, security and scalability becomes a challenge — more so if compared to having similar applications being built on other platforms (say: AWS, GCP, Firebase etc.).

In this post, we’ll see how to navigate our way through said constructs by addressing parts of these problems and also explore ways in which we can bake some solutions right from the get-go!

In this post Sourabh Choraria provides some very useful answers for common questions organisations have when using Google Apps Script as part of their infrastructure. Points covered in this post include: managing concurrent executions; being able to securely store, access & manage API keys, tokens; and considerations around quotas.

Source: Reliable, Secure & Scalable use of Apps Script | Google Developers Experts

AppSheet purchased by Google Cloud – News – Google Groups

Google Cloud has acquired AppSheet. Do I care? At first I thought, “Not really, it’s just interesting news.”

I guess that I do care in the sense that I want to be valued as a programmer, and no-code development feels like programmers are being thrown away in favor of something else. The driving force behind this is development costs. Even if an independent programmer only charged $5 dollars an hour, in two hours the customer would have paid $10 dollars, which is twice as much money as the $5 a month AppSheet plan.

It was recently announced that Google has acquired AppSheet a low-code platform for business users that lets you build applications that can integrate into a variety of sources including Google Sheets. This has resulted in an interesting thread on the Google Apps Script Community Google Group linked to from the source link at the end of this post, in particular, impact on Apps Script developers. On the one hand you can argue that products like AppSheet, with there low/no code environments remove the need for developers. However, the general consensus on the thread is rather than removing developer opportunities it may in fact create them with opportunities to extend the basic functionality of AppSheets. This comment from Alan Wells in particular caught my eye:

What AppsSheet does, is increase the number of apps and code being created, as opposed to lots of business creating no apps at all. It’s kind of like, you need a lot more mechanics if everyone can afford a car. If only the rich can afford a car, then there aren’t going to be many car mechanic jobs. So, I think that AppSheet is filling a need, which increases the number of apps. Some of those apps will crash, and they’ll need the equivalent of an auto body technician to repair the damage. This is part of the evolution of the computing industry.

You can join in on this discuss using the following link:

Source: AppSheet purchased by Google Cloud – News – Google Groups

I summarized my own practices on what Google Apps Script is strong and when to use it

Yuki Tanabe shares some strengths and weaknesses of Google Apps Script as well as criteria for choosing Google Apps Script for your coding project

Source: I summarized my own practices on what Google Apps Script is strong and when to use it

2019 – a decade in Apps Script | Desktop Liberation

A brief history of apps script capabilities – There’s been much coming and going over the past 10 years. Here’s a non-exhaustive list of some of the winners, and losers.

Source: 2019 – a decade in Apps Script | Desktop Liberation

Why you shouldn’t use Google Sheets as a database – Eric Koleda – Medium

At this year’s Google Cloud Next I co-presented a session entitled “How to grow a spreadsheet into an application,” where the thesis was that it’s OK to start with a spreadsheet and layer on additional technologies as you gain adoption and your requirements change. However that doesn’t mean that Sheets is always a great choice for storing your application’s data, and in this post I’ll explore some of the signals that you should be looking into other database options. Sheets are for people!

Source: Why you shouldn’t use Google Sheets as a database – Eric Koleda – Medium

Why Google Apps Script Is a Great First Programming Language to Learn

Google Apps Script is the perfect programming language to learn first, even if you’ve never heard of it before! Here are 7 reasons why.

Source: Why Google Apps Script Is a Great First Programming Language to Learn