I have this working very nicely :
var theForm = HtmlService.createTemplateFromFile('aForm').evaluate();
var theSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
theSpreadsheet.show(theForm);
When the user has submitted data I want to close “theForm”. Is there something like an unShow() or hide() method on a spreadsheet? a harikiri() method on an HtmlOutput?
Ideally, I’d like to have a reShow() command that saves the submitted data, refreshes the spreadsheet and calls show() again.
I have found no way to do these things, so I just disable the submit button. Ugh!
Any suggestions greatly appreciated.
UPDATE (2012/08/28) : I should have mentioned that I am calling back into the same code as originally opened “theForm”, from the HTML form, using this call …
google.script.run.recordTheForm(jsonTheForm);
Do I assume correctly that google.script.run.*() calls have no knowledge of any variable values set earlier?
HtmlService doesn’t have an equivalent of app.close()… this is an oversight, not something by design, and we will fix it.
Edit: From within client-side JavaScript code (not from the server like
app.close(), but within the HtmlService code itself) you can now callgoogle.script.host.closeDialog()