3

In my Google Sheet cell D12 gets the difference of two numbers with =D9 - D4. How do I store the value in cell D12 to a log in another sheet on a daily basis? I would like each row in the log sheet to show the date and the difference. An onEdit() based change tracker will not work for this, because the difference should be saved once a day rather than every time the sheet is edited, and because the value I want to track is in a formula cell that is never edited.

I have looked at the answers at Access Google Spreadsheet revision history through API but do not think they work for this use case, because they use an onEdit() function that runs every time the spreadsheet is hand edited. In my use case, the value should be logged once a day. Further, an onEdit() function will not run when the value in a formula cell changes because that cell is not manually edited.

1

1 Answer 1

2

To permanently record a value in a log once a day, you will need a script. The script should read the value in cell D12 and use sheet.appendRow() or similar to append it to a log sheet together with a timestamp. Run the script through an installable trigger that executes once a day.

There is a complete example of how to do this in the appendValuesToArchiveSheet script.

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