Google-sheets – Adding numbers to a cells formula

google sheetsgoogle-apps-script

Let's say A1= X+Y
Now I'd like to add +Z with a script so I end up with A1= x+y+z. I know how to copy it, or overwrite it, but not sure exactly how I would add to it with a changing formula in A1.

Some combination of getrange and copyto but also adding something to the end?

Best Answer

You could also resolve this by storing variable z into the script and then call for it like:

var variables = [2.54]
function zzz() {
  return variables[0];
}

A1:

=5+10+zzz()

or A1:

=B1+C1+zzz()


Different Example:

0