Answer the question
In order to leave comments, you need to log in
Script for recording changes in the values of one cell for google spreadsheets?
We need a script for google spreadsheets that builds a graph of changes in the values of one cell by day.
For excel, there is such a script - the script builds a column of changes with a given timeframe, and then a graph is built on it, but when transferring tables to google (because I am not familiar with them), it does not work.
Answer the question
In order to leave comments, you need to log in
Use function onEdit(event) to determine if a cell has changed.
event.source..getActiveRange().getA1Notation() to determine the address of the cell
Then just accumulate the data somewhere. Below is the code to validate sheet "Sheet1" and cell "A1" in it. Data is accumulated on the "Archive" sheet
function onEdit(event){
if ((event.source.getActiveRange().getA1Notation()=="A1")&&(event.source.getActiveSheet().getName()=="Лист1")){
var arc=SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Архив");
arc.getRange(arc.getLastRow()+1,1,1,2).setValues();
};
};
Gregory, thanks for the script!
Indeed, it writes the values when the cell changes, but is it possible to change the script so that it writes the value when not the cell changes, but the value in it?
Here's what I mean - the value in the cell whose history I want to keep is formed by a formula. It turns out that the value changes, but there is no cell change, so the data is not written to the history.
Maybe you can record once a day?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question