I have the below script which is intended to automatically filter the active sheet:
function setFilter() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var filter = {};
filter.range = {
sheetId: tab.getActiveSheetId()
};
filter.criteria = {};
// Which column to add the filter to
var columnIndex = 0;
filter['criteria'][columnIndex] = {
'hiddenValues': ["✘"]
};
var request = {
"setBasicFilter": {
"filter": filter
}
};
Sheets.Spreadsheets.batchUpdate({'requests': [request]}, ss.getId());
}
Unfortunately, I am getting a reference error mentioning that the tab isn't defined - what do I need to change? I have tried removing sheetID