bradjasper / ImportJSON

Import JSON into Google Sheets, this library adds various ImportJSON functions to your spreadsheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to refresh / update data in cell?

drewclifton opened this issue · comments

commented

Is there a way to make sure that the data showing in the cell is actually current?

Does reloading the web page (spreadsheet) fetch new data?'

The only way I see* is to actually edit the URL to something else, but that's not practical as I have a number of URLs on my sheet that I am pulling data from.

*I'm just going off of how to get the word "Loading..." to appear, which I assume means it's fetching data...

Thanks

I would like to get the data showing in the cell is actually current too.

commented

This worked for me. It adds a time stamp each time it updates.

https://www.youtube.com/watch?v=ylH_7i4hLwc

function importJSONupdate() {
var randChange= Math.random();
var d = new Date();
var timeStamp = d.toLocaleTimeString();
var cellValue = '=ImportJSONBasicAuth("[https://acumatica.conciseit.net/Odata)","","", "/value", "noInherit, noTruncate","' + timeStamp + '")';
SpreadsheetApp.getActiveSheet().getRange('A1').setValue(cellValue);

}