I am trying to update certain cells in Google Spreadsheet using my own code using Google App Script.
Let say I have 2 cells (A1 and A2) filled with 1 and 2.
In the cell C1, I have used custom function called "AutoUpdateMyCell".
What the function does is just getting values from A1 and A2 and add to each other, and fills the cell (C1) with the new value (which is 3).
But the problem starts when I change 1 of the values in either A1 or A2. The value in C1 doesn't update automatically.
How can I also make C1 update when I change 1 of the values in A1 or A2?
I know there is a function onEdit(), but I am not sure how to use that for my problem.
I could just use onEdit, and get the values from A1 and A2 and then put that in C1, but I want to make it dynamic, so I don't have to check for specific cells, if you get want I mean.
This is my function in pseudo code
function AutoUpdateMyCell(cell1, cell2)
{
var value1 = cell1.getValue();
var value2 = cell2.getValue();
return value1 + value2;
}