This is how such a script can work. The variable startRow is fixed at 12 here - an alternative option is to take it from the current selection, which would be startRow = sheet.getActiveRange().getRow();
The script then searches column A for "end of list" text, and then deletes the required number rows.
function deleteRows() {
var startRow = 12;
var sheet = SpreadsheetApp.getActiveSheet();
var colA = sheet.getRange('A:A').getValues().map(function (row) {
return row[0];
});
var endOfList = colA.indexOf('end of list') + 1;
if (endOfList > -1) {
sheet.deleteRows(startRow, endOfList - startRow);
}
}
Note that this is really deletion, not merely clearing out the rows. To clear the content but leave the rows, replace the line with sheet.deleteRows
by
sheet.getRange(startRow, 1, endOfList - startRow, sheet.getLastColumn()).clear();