I saw this post where a Google Sheet (I call it 'GS') will essentially stop scraping Google Finance info if not left open. I use a Google Apps Script (I call it 'GAS') to ensure that I am emailed about certain changes in my GS via the Trigger system in GAS. Please tell me if my source is up to date.
My source is another post from several years ago. Google finance 200 day moving average is getting as #NA in Apps Script
Apps Script triggers run on Google's servers, not in your computer, and are thus independent of whether you or somebody else currently has the spreadsheet open.
Google Sheets formulas, such as googlefinance()
, only recalculate their result when a user has the spreadsheet open, and when a script reads from the spreadsheet.
To make sure that your script gets up-to-date values, make it first read any cell in the sheet that you are interested in, sleep for say five seconds, then read the values you're interested in.