How to close sidebar with the new IFRAME mode in G

2019-06-01 15:50发布

问题:

I'm using a sidebar in a spreadsheet. Due to the introduction of the new IFRAME mode, I'm now initialising the sidebar with:

.setSandboxMode(HtmlService.SandboxMode.IFRAME);

It is working fine, except now the following function doesn't close the sidebar after successfully running myFunction as per below:

 google.script.run
    .withSuccessHandler(google.script.host.close)
    .myFunction(myVar);

Does anyone know how to fix this?

Thanks in advance!

回答1:

you need a () after close. google.script.host.close()