I am currently storing a value each day using the function below:

function addTrigger() {

function updateCell() {
  var url = "https://docs.google.com/spreadsheets/d/12yxNcp0n5_-------------d6B81m6QcjrKXTQDvyx0/edit#gid=377838361";
  var cellOut = "L23";
  var cellIn = "B19";
  var value = SpreadsheetApp.openByUrl(url).getRange(cellIn).getValue();

I would like to be able to increment the row value each time that the script is run. Since the variable call is done at each run of the script I would assume that there is no global variables to use. So how could one have a variable that increment with each run of the script.

I have read about using PropertiesService to make a sort of global variable, however there must be some more standardized way to increment a value for each time a script is run in google sheets scripts.

I am fully aware that I need to set my Range using Col and Row arguments so I do not need assistance on that, but on how to increment the value that I can put in as the Row.

Truly thankful for your help

  • If you describe what is the goal that you wan to achieve with your script maybe I could give you a more specific answer than the one that I already posted. Commented Nov 22, 2019 at 16:19

1 Answer 1


In a general sense, in Google Apps Script, the most "standardized way" to have a variable that increments on each execution (a persistent variable) that we could use is the Google Apps Script Properties Service

Another common way is to save the row number is to save it in a spreadsheet cell.

  • thank you, saving the row number in a cell will solve the issue I have. I guess I have overlooked that possibility all this time. Again huge thanks
    – LuckAss
    Commented Nov 26, 2019 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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