I have a script that sends emails to a list of recipients per row. For every row it checks certain conditions and sends an email with different information taken from different columns of that row. The file is the following:
https://docs.google.com/spreadsheets/d/1n5nRET7M6NnI1gZg_WRA4xiEA5ZDKsfUhTnAoP_xpF4/edit?usp=sharing
This question is divided in two parts:
Part 1: I want to stop a script when it reaches the last row, of a specific column (I believe this is the easier way), with content. I used the following code and it used to work. However, now it's not wokring and I don't understand why.
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var limit = sheet.getLastRow(); //number of rows in the sheet
var Avals = sheet.getRange("E:E").getValues();
var Alast = Avals.filter(String).length;
for (var row = 3; row <= Alast+1; row = row + 1) {
Does anyone have an idea of what could be the issue and have any alternatives?
Part 2: The current code used to stop working after line 105 (from what Iw as able to estimate). Basically, if the last row with content was 85, it would stop the script on that row. However, if the last row with content was 106, the script only worked until 105 and would not sned the email on line 106 (despite meeting the required conditions). Does anyone know how to fix this?
Thank you in advance.
UPDATE:
Part 1 of the question is solved. I found the problem I was having with the files. Part 2 of the questions is still a problem, though. Thank you