Running things in parallel using HTML service

Apps Script is inherently synchronous - you cant do lots of things at once. Primarily to get round the execution limit, I did a science project using triggers for parallel processing but the triggers are fairly unpredictable in when they get round to executing. 

HTMLservice allows you to run JavaScript on the client, and you can also run Apps Scripts from within the HTML service. So the question is whether they will run asynchronously, each with a separate quota, and whether I can manage to get this working within the confines of caja. 

The answer is YES and YES and YES!

There's a new and improved version of this over on Orchestration of Apps Scripts - parallel threads and defeating quotas

Demo example

Here's a quick 15 second video of simple map/reduce exercise of 3 map tasks in parallel followed by a reduce of the results.

Here's what a completed progress sidebar looks like. Note that each task shows how long it took to complete - This example shows that we got 23 seconds of compute time done in 10 seconds through parallel running. All the bars are green so nothing failed. You'll notice the bars changing colors at different stages of execution.

For more on this see

For more snippets like this see Google Apps Scripts snippets

For help and more information join our forum,follow the blog or follow me on twitter .

You want to learn Google Apps Script?

Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly

If you prefer Video style learning I also have two courses available. also published by O'Reilly.
Google Apps Script for Developers and Google Apps Script for Beginners.