I want to update every minute a cell with data from a HTML link. The problem is that the value does not update unless I manually empty the cell or make changes to the script. I tried to add NOW() to the script but the cells do not update. I do not know much about JavaScript. Could someone explain to me what and where in the script I should add or change something?

This is my script:

function DataFromDomoticz() {
  var now = new Date();
  • it is not updating after 30 minutes
    – Coen17st
    Jan 18, 2019 at 15:36

2 Answers 2

  • go to File
  • select Spreadsheet settings...
  • change recalculation like this:


  • you can test it with this formula:

                   50;51;52;53;54;55;56;57;58;59}, RAND(), RAND())


To add a formula to a spreadsheet, instead of setValue(formula) use setFormula(formula). For details on how to use this method please checkout https://developers.google.com/apps-script/reference/spreadsheet/range#setformulaformula.

Google Sheets isn't recalculating because the formula because it is exactly the same and due to Google Apps Script / Google Sheets optimization algorithms that is being ignored. To fix this your code should clear the formula, then use Spreadsheet.flush() to apply the change to the spreadsheet, then add the formula to the cell.


In this case, the formula include a custom function, ImportJSONBasicAuth. There is a famous open source project that include a function of the same name. This famous project also include an advanced function that could be used to do the same that ImportJSONBasicAuth. This function could be used instead of the custom function to be called by a time-driven trigger.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.