I am writing a simple script that basically reads a value and send it to another sheet upon clicking a button. For testing purpose I wrote:
SpreadsheetApp.flush() var sheet = localSheet.getSheetByName('Input'); var dateTimeRange = sheet.getRange(2,2); var dateTimeValue = dateTimeRange.getDisplayValue(); localSheet.toast(readingValue, dataTypeValue)
In my spreadsheet setting, I set: File->Spreadsheet settings->Calculation->On change and every minute
Cell in range 2,2 has
So, every minute, the value in cell 2,2 recalculates itself. But when I run the script, the output value that I see is always the value of the last time I modified the sheet. As long as I don't interact with the sheet, the script is unable to read the new value. I tried adding flush(), doesn't work. Anyone have any idea?