Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Apps Script Close()

Is it possible to close a UI window that has opened in Apps Script?

I think the answer is no per: http://code.google.com/p/google-apps-script-issues/issues/detail?id=474&can=1&q=.close%28%29&colspec=Stars%20Opened%20ID%20Type%20Status%20Summary%20Component%20Owner

but I wanted to see if there were other opinions.

I have a "Waiting window" that pops up, that I want to close when the activity is finished.


var app = UiApp.getActiveApplication();

var ss = SpreadsheetApp.getActiveSpreadsheet();

var sheet = getSheetWithSubmissions(ss);

// create UI app, this works fine

app = createWaitPleaseUI(sheet);

ss.show(app);

//simulated activity

Utilities.sleep(5000);

//this doesn't work despite being in the documentation

app.close();

Think this is not possible but wish Google would dump it from their documentation if it can't be done.

As a workaround, I can bring up a second GUI saying "work complete, click OK" and then it works fine.

like image 311
Michael Taylor Avatar asked May 01 '26 22:05

Michael Taylor


1 Answers

You have to return the app object for any changes to be updated to it, even closing.

Change your last line to return app.close() instead.

like image 197
Henrique G. Abreu Avatar answered May 05 '26 08:05

Henrique G. Abreu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!