Hi, in the code below I am trying to reference the column number within setColumnFilterCriteria from the named range AttendeeStatus so that this piece works no matter where this column is. Any ideas on how to do so?
Code:
function FilterAttendees() { var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('AttendeeStatus').activate();
spreadsheet.getRange('AttendeeStatus').createFilter();
spreadsheet.getRange('AttendeeStatus').activate();
var criteria = SpreadsheetApp.newFilterCriteria()
.setHiddenValues(['', 'Attending'])
.build();
spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(, criteria);
spreadsheet.getActiveSheet().setName('Registrants');
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.insertSheet(1);
spreadsheet.getCurrentCell().activate();
spreadsheet.getActiveSheet().setName('Attendees');
spreadsheet.getCurrentCell().activate();
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Registrants'), true);
var sheet = spreadsheet.getActiveSheet();
sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns()).activate();
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Attendees'), true);
spreadsheet.getRange('Registrants!A1:Z500').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('AttendeeStatus').activate();
spreadsheet.getActiveSheet().getFilter().remove();
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('1:1').activate();
spreadsheet.getActiveRangeList().setFontWeight('bold');
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Attendees'), true);
spreadsheet.getRange('1:1').activate();
spreadsheet.getActiveRangeList().setFontWeight('bold');
};