VideosMy ProjectsProgramming BlogGallery
  1. Home
  2. Blog
  3. Use promises in Google Apps Scripts
Programming Blog

Atom/RSS Feed


Use promises in Google Apps Scripts


To use the latest es6 Promises in google app scripts it is very trivial to do so.

You need to include the Promises in the polyfill

Including Promises

Include the following code at the top of your file which you wish to use promises in.

var Promise,
   setTimeout = setTimeout || function (func,ms) {

(function () {  

 // get the polyfill and eval
 if (!Promise) {
   var result = UrlFetchApp.fetch('');
   eval (result.getContentText());

   // add done for compatibility with other promise systems
   Promise.prototype.done = Promise.prototype.done || Promise.prototype.then ;


Join my mailing list