1

I am using " ImportJSON by Trevor Lohrbeer (@FastFedora)for ref. " library for importing JSON feeds into Google spreadsheets.

Simply to say I just input the function =ImportJSON(url, query, options) into the cell and the cell returns the data there.

And everything is fine but the data in google spreadsheet would not be updated automatically when the JSON data in the url changed. I have to re-enter the function again into the cell or refresh the script manually to get it done.

So can anyone suggest some solution to me?

kkkttc
  • 29
  • 2
  • 8
  • You will find an explanation for formula recalculation [in this answer](http://stackoverflow.com/questions/31251115/function-for-last-modified-date-of-cell/31277867#31277867), which will at least help you understand the situation. Since the retirement of the `GOOGLECLOCK` function, there is no formula that will trigger automatic recalculation. – Mogsdad Jul 11 '15 at 14:57

2 Answers2

0

UDFs in Sheets will only be recalculated if the cells that it references change. There are some suggestions on 1, I would suggest setting up triggers that recalculate the sheet every time that you:

  • re-open it
  • change a cell - depending on how much you use the data
  • recalculate it periodically with time-driven scripts
Community
  • 1
  • 1
T J
  • 1
  • 1
0

The problem is solved.

I use the method answered by T J and the suggestions link. I put one more extra para like $A$1 into the original function

=myFunction(firstParam, $A$1)

and add one more function in my gs

function onEdit(e)
{SpreadsheetApp.getActiveSheet().getRange('A1').setValue(Math.random());}

then the cell would be updated when there is any edit in the sheets or the onedit(e) is trigged.

Finally, I use the trigger timer to trigger the onedit every min to get the data keep updated!

Thanks!

PS: Previously, the trigger setting was not work for me because the the importjson function is only work for triggering the whole importjson.gs but not just triggering the functions separately like the setting in the trigger menu.

kkkttc
  • 29
  • 2
  • 8