I asked [this question](https://stackoverflow.com/questions/74019400/google-apps-script-email-automation-errors/74020391#74020391) and thought I had gotten the resolution, however, after it ran properly the first time, the next day I ended up with a bunch of trigger errors stating: *Exception: Ranges must have at least one range.*

The new rows of data being added are still being marked "Y" in Column I, as if the email got sent out for it, but I'm either not receiving an email, only receiving one email when more than one row was added at one time, or receiving an email containing information from the wrong row of data (the last/oldest row rather than the new row).

This is the script I'm using to send an email notification whenever new row(s) of data are added - it should be sending one email per new row of data, and then mark "Y" in Column I of the corresponding row.

```
  function email() {
  var ActiveSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("First Time Users");
  var StartRow = 2;
  var LastRow = ActiveSheet.getLastRow();
  var RowRange = LastRow - StartRow + 1;
  var WholeRange = ActiveSheet.getRange(StartRow, 1, RowRange, 9);
  var AllValues = WholeRange.getValues();
  var ranges = [];
  for (var i = 0; i < AllValues.length; i++) {
    var CurrentRow = AllValues[i];
    var EmailSent = CurrentRow[8];
    if (CurrentRow[7] == "Y" && EmailSent != "Y") {
      var message =
        "<p><b>Request: </b>" + CurrentRow[0] + "</p>" +
        "<p><b>Account: </b>" + CurrentRow[1] + "</p>" +
        "<p><b>Appointment Created Date: </b>" + CurrentRow[4] + "</p>" +
        "<p><b>User: </b>" + CurrentRow[5] + "</p>";
      var setRow = i + StartRow;
      var SendTo = "testemail@gmail.com";
      var Subject = "First Time User Submitted Ask:  " + CurrentRow[1];
      MailApp.sendEmail
        ({
          to: SendTo,
          cc: "",
          subject: Subject,
          htmlBody: message,
        });
      ranges.push("I" + setRow);
    }
  }
  ActiveSheet.getRangeList(ranges).setValue("Y");
}

```

This is the trigger I have which is currently set to run every 24 hours...previously I had it run every 5 minutes (before this, I had used an On Change trigger, as shown in my previous question linked above):

[![enter image description here](https://i.stack.imgur.com/KS3s1.png)](https://i.stack.imgur.com/KS3s1.png)

Any guidance would be greatly appreciated. Thanks!