I need to create a log of sorts and would like it if i could have an empty row (Row 2) and when something is entered in row 2 it adds a new empty row above so the newest entry is always at row 3, is this possible in google sheets and if so, how?

  • Welcome. Would you please add a brief description of your search/research efforts. – Tedinoz Aug 9 '20 at 12:53
  • "and when something is entered in row 2..." You haven't thought this through - there's not enough information for an answer because you haven't said how many columns of information are in row 2, and/or how to know when the data entry is finished. For example, if there are several cells in the row, then you don't want to insert a new row until the last cell is completed. Perhaps one option is to have a checkbox in the column adjacent to the last data cell. Then when data entry is completed, tick the checkbox. A script can wait until a checkbox in row#2 is edited, and then insert a new row. – Tedinoz Aug 19 '20 at 2:58

This answer assumes that the user will tick a checkbox on row#2 when data entry is complete.

Editing of data in any other row and/or checking the checkbox in any other row does not trigger the script.

function onEdit(e) {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = e.range;
  var editedrow = range.getRow();
  var editedvalue = e.value;
  if ( editedrow === 2 && editedvalue === "TRUE"){
    // the checkbox on row#2 was ticked.


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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