CTRL S in the end of the script

52 views
Skip to first unread message

Amir Gan Mor

unread,
Dec 17, 2019, 3:43:31 AM12/17/19
to Google Apps Script Community
hi , Im using google sheets script editor , in order to refresh data from Looker app (doent really important)
I want to create a function which whenever i call her my  data will be updated
the thing is - only when i hit cntl S on the" google sheets script editor" function - meaning only when i save - my data in the google sheets  in updated

so my question :
1. most immediate solution to my problem - how can i call "ctrl s" in " google sheets script editor" function ? (which will update the data and will solve my problem)
2. the ctrl s - must clear the cache or something - and this must be causing the google sheets to update - is there another way for me to update the google sheets in the code?

TNX

Amir

Alan Wells

unread,
Dec 17, 2019, 9:26:35 AM12/17/19
to Google Apps Script Community
SpreadsheetApp.flush();//Applies all pending changes in the spreadsheet

The above line of code, run in a gs file will force cell formulas to recalculate.  SpreadsheetApp.flush() works for code that is bound to the spreadsheet.  If changes are being made to the Google Sheet from some external source, that's different.

Sohail

unread,
Sep 28, 2023, 3:36:27 AM9/28/23
to Google Apps Script Community
Just a corollary to this primary question:
Is there anyway to achieve the same effect for an external google sheet (that is being referenced and written by the script in container Google sheet)?
My script is writing down or modifying values in an external G Sheet and then create its MS Excel copy. However, since there seems no current way to force all cells to have latest values, sometimes, the recently created Excel shows older values from the external G sheet.

Thanks.

CBMServices Web

unread,
Sep 28, 2023, 11:42:49 AM9/28/23
to google-apps-sc...@googlegroups.com
You will need editor access to the external spreadsheet for this 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/076c6f62-bed4-45ff-97a3-7282f7d99bb4n%40googlegroups.com.

Sohail [FazlRabbi Tech]

unread,
Sep 29, 2023, 12:16:51 AM9/29/23
to google-apps-sc...@googlegroups.com
Thank you for your response but editor access is already there because of which the script is writing values to external sheet.
The issue here is to make sure that those values are reflected there before the G Sheet is exported as Excel.
It seems that SpreadsheetApp.flush() is only effective for parent sheet only and not for external sheet.
And the question is how to achieve the same?

Thanks.

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/ohPrWzINYRk/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAFX%2Bz3VOea%2BwpdxRsExgXeTAtkpOwrsKT3BgBLvpEy8qhuzFsg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages