Using the macro facility in Google Spreadsheets can be quite powerful, but I’ve found the documentation difficult to navigate.
For future reference, here is how to iterate over a range of cells that has been predefined (using a named range or in some other manner).
var rangeName = 'mailingdate';
var range = SpreadsheetApp.getActiveSpreadsheet().getRangeByName(mailingDateRangeName);
var arr = mailingDateRange.getValues();
for (var i = 0; i < arr.length; i++) {
var rowVal = arr[i][0];
if (rowVal.length < 2) { // 2 because of spaces
continue;
}
//... process non empty rows.
}
Note that this only processes a range with one column (hence the arr[i][0]. Ranges with multiple columns are left as an exercise for the reader.
