Help refreshing GOOGLEFINANCE data

I have downgraded from PRO to BASIC as I simply did not need all the features of PRO. However, one feature I overlooked was the auto refresh. Now my GOOGLEFINANCE data no longer flows into the app automatically (i.e. GLIDE no longer refreshes periodically in the background). While that is not ideal, I can live with it if there was a “easy button” I could have in the app that would simply fetch the latest data.

I hate to go to PRO as this app is purely for personal reasons. That is also why I could no longer justify the PRO cost, since it is just me using it, and downgraded to basic. But if I cannot refresh, basic is useless and GLIDE is likely no longer the answer for me sadly.

Any ideas?

Glide stops refreshing google since they change to new plans… so even if you pay, it will be hard to get… just add a button that writes the current date to some google sheet column, and that will force Glide to sync.

I use a switch in my Google finance app:

function onChange(e){
var sheet = SpreadsheetApp.getActive();
var range = sheet.getRange(“J2”);
var check = range.getValue();
var time = sheet.getRange(“J3”);
if (check == 1) {
range.uncheck();
time.setValue(new Date());
}
}

Hi Craig,

If you don’t mind using Yahoo Finance instead of Google I think you can try this.

  • Have a list of symbols.

  • Create a template to construct the Yahoo link.

https://cors.eu.org/https://query1.finance.yahoo.com/v8/finance/chart/{X}

with {X} being the symbol.

The prefix https://cors.eu.org/ is for overcoming the CORS issue to fetch the data.

  • Use a fetch column to get the price.

I’m not sure if this refreshes regularly. If it doesn’t, I would suggest adding a timestamp value to the URL (e.g ?t=[current time in numeral value]) so that it refreshes regularly. You might not want to do it every 10 seconds based on Glide’s update interval, maybe 10-15 minutes or an hour would do.

1 Like

Thind, that timestamp parameter to refresh info regularly is something native to Yahoo API or a trick?

Yes, an auto refresh tool we don’t have yet to refresh data in background. My best effort to have something like it is this: Automatic Toggle Trigger 💡

but of course, your APP must be loaded and running!

Saludos!

That is a general trick I have done since my days of using IMPORT to get data into Google Sheets.

:flushed:

May you type a couple of examples to learn that trick?

Thanks

Say I have a link to fetch that looks like this:

https://example.com?query=abc

Next, in the Glide builder, I add a math column to derive the current time in numeral format.

YEAR(N)*10000000000+MONTH(N)*100000000+DAY(N)*1000000+HOUR(N)*10000+MINUTE(N)*100+SECOND(N)

It will return a numeral value in the format of YYYYMMDDhhmmss. Let’s say my current time is 07:38:59 AM, 26th June 2022 then that value will be 20220626073859.

Then, I add a “t” parameter to that link so that it will refresh every time Glide’s “current time” changes.

https://example.com?query=abc?t={T}

with {T} being the math value I calculated above. That will change every 10 seconds or so, hence a new fetch is done by Glide since the link is changed.

The “t” param can be whatever text you want, as long as it is considered “harmless” for the structure (the website doesn’t use it as a normal param)

2 Likes

It’s a technique that’s commonly known as cache-busting

2 Likes

hah!

@ThinhDinh - getting off topic here, but it just occurred to me that this would probably be an effective method to force an update of an app icon. ie. just load the app in a browser and add a random query string to the end of the URL :slight_smile:

…although, I suppose that still counts as re-installing the app. But sometimes the old icon will persist even after a re-install, because it’s still cached in the device browser. So this would overcome that issue and avoid having to completely clear the browser cache.

Edit: Scratch the above. I tested and it doesn’t work. :crazy_face: You can add random parameters and the app loads, but the extra parameters are stripped when you add to home screen, and so you wind up with the original URL. At least with Safari on IOS.

Edit 2: duh, of course this won’t work, on any device or in any browser. The only way it would work is if you could append a random query string to the direct URL of the icon image file.

1 Like