Chrome connect with another account - Script does not work

40 views
Skip to first unread message

Sébastien HAROUET

unread,
Sep 7, 2020, 7:18:31 PM9/7/20
to Google Apps Script Community

Hi,


I have a very simple script creating a modal html window with one button.

If I click on the button, I would show an alert to close the modal window.


he is my project : 


https://docs.google.com/spreadsheets/d/1gAA3T70yiL-Bg0YZpyzWtzd-18UXrSscFT6_Cy3F7qQ/edit?pli=1#gid=0


I have several Google account.

  • If I am chrome synchronized with ACCOUNT_1 and spreadsheets also connected with ACCOUNT_1
    • My script is functioning and I can see the alert box
  • If I am chrome synchronized with ACCOUNT_1 and spreadsheets connected with ACCOUNT_2
    • My script is NOT functioning. I mean the modal window is displayed but when I click on the test button, the modal window is still here and the alert box does not appear.


Why ?


Regards,

Sébastien

CBMServices Web

unread,
Sep 7, 2020, 7:41:57 PM9/7/20
to google-apps-sc...@googlegroups.com
Each account needs to authorize the script for it to run. All accounts need to have at least edit sharing status on the spreadsheet to allow that to work.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/53b7bc91-04ad-4add-94b5-8ce13482d027o%40googlegroups.com.

Jean-Luc Vanhulst

unread,
Sep 7, 2020, 9:43:09 PM9/7/20
to google-apps-sc...@googlegroups.com
I have been struggling with this for months. But literally today got it all sorted out. There's not enough good documentation on this.

Sorry if I destroyed your script - but at ;least you have a working version now.

The essence: - you cannot CLOSE before the call function is done. And the close only happens with google.script.host.close() which you want to call with the SuccessHandler - AFTER your script function returns TRUE (for success)

I did a lot of Google and some of the example scripts seemed to work but it turns out the also only something (like in a very small spreadsheet). Your Logger.log functions for example take quite a while to complete (relatively speaking).
So you'll see the log now from the CloseModal function.




Sébastien HAROUET

unread,
Sep 8, 2020, 5:54:23 AM9/8/20
to Google Apps Script Community
Thanks a lot, it almost work !

The only thing I need to do is when the modal window is close, an alert box appear.   SpreadsheetApp.getUi().alert("closed");

I was not able to do this with you script.

Sébastien
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.

Jean-Luc Vanhulst

unread,
Sep 8, 2020, 6:27:19 AM9/8/20
to google-apps-sc...@googlegroups.com
You cannot do that. The callback function can not open a window. The only thing you can do is update the window that is still open by returning false and leaving hhe window open. 

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.








--


You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.


To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
--


You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.


To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/e119b084-07a8-4ab4-bc3c-ff9323c305c3o%40googlegroups.com.


--

Sébastien HAROUET

unread,
Sep 8, 2020, 1:09:09 PM9/8/20
to Google Apps Script Community
OK I understand, this is clear

Thanks
Sébastien

Jean-Luc Vanhulst

unread,
Sep 8, 2020, 1:19:30 PM9/8/20
to google-apps-sc...@googlegroups.com
It took me a long time. I hope that soon they will release the ability to work with the Card interface in Google Sheets as well. 
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages