Up till now we’ve been dealing with running this stuff as a sidebar on spreadsheet.
Now we’ll take the example in Parallel implementation and getting started – doing some cryptography exercises in parallel and run it as a web app. You could add a bunch of parameters to this – even passing an entire profile as a parameter, but for simplicity we’ll just set up a default profile and use that.
I’m going to use the same script as I used in Parallel implementation and getting started, but add a doGet() function to handle the webapp functionality, and publish it. It’s just a few lines.
function doGet(e) { return worker (cryptoProfile(25,false)); } function worker (profile) { var htmlName = 'asyncService'; var html = HtmlService.createTemplateFromFile(htmlName) .evaluate() .getContent(); html += "<script>\n" + "doSomeThings( " + JSON.stringify(profile) + ");\n</script>"; return HtmlService.createTemplate(html).evaluate() .setSandboxMode(HtmlService.SandboxMode.NATIVE); }
For more snippets like this see Google Apps Scripts snippets