One problem with running things from html service with google.script.run is that you don't have access to logging and execution log, so it's difficult to debug. I like to run my profile components inline first to make sure they work. Here's how you can simulate running this stuff from google.script.run in the context of a normal apps script.
This function takes your profile and executes the named function, and passes over the data just as would happen if it was called from google.script.run.
We can call that, passing each of the individual run profiles, and emulate passing the data from the previous stage just as happens when being orchestrated by the html service. Of course you can only run one thing at once, but this allows you to test all your profiles in a much more visible environment.
Notice that I use functions to set up the profiles. I use exactly the same ones when running this for real. That way I can be sure I'm testing what I'm planning to use in real life. Here's the example for the reduce function.
Later on, when I run this for real, I put it all together like this
You may also find this post useful, if you have some unserializeable objects to deal with. How to pass non stringifyable objects to html service
For more on this topic, see Running things in parallel using HTML service. 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 .
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Google Apps Script HTML service > Running things in parallel using HTML service >