If you have ever worked with Google Apps Script (GAS), you may have found yourself in this situation. You want to move some files from some Google service to another, e.g., from Drive to a Google Cloud Storage Bucket. You get the file’s contents using GAS’s built-in service in the form of a Byte array. You pass this byte array to the URLFetchApp.fetch() function in the body.
All is going good and well, but then you notice. Why is it taking 30 seconds to upload a 10MB file? Am I doing something wrong? Is GAS not meant for this?
Don’t panic. I’ve been there, and I decided to take a closer look. Here’s what I found.
In this article Ignacio Lopezosa takes a deep dive into how to handle bytes in Google Apps Script, sharing his journey in finding a solution on how to share (large) files.
There’s a long standing issue with triggers installed programmatically by other triggers, that was kind of fixed last year, but users are still reporting problems, at least in certain locations (Japan, India and others). The issue in short: triggers installed programmatically would not be created, or fail systematically.
In many cases this affects add-ons (and, to be noted, the issue still persists when testing them, see Testing details); I had a slightly different scenario: a webapp that, when executed (doGet), would install a time based trigger for the user executing the script.
This article provides two solutions to an annoying issue and unlocks many possibilities for programmatically installed triggers.