AppsScriptPulse

Handling bytes in Google Apps Script with Blobs

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.

Source: Handling bytes in Google Apps Script

Leave a Reply

Your email address will not be published. Required fields are marked *