SheetAPI.addFilter2Span method is used to add filter to a range of selected cells with the specific condition.
Parameters[sheetId, startRow, startCol, endRow, endCol] startRow: should be >=1. 1 means first row for the selected sheet. startCol: should be >=1. 1 means first column (column A) for the selected sheet. endRow: should be more than startRow or zero. If the value is zero, it means all cells below the startRow are selected. endCol: should be more than or equal startCol.which define the specific sheetId and a range of cells which need to be added filter.
6 : { 'type': 'match', 'values': ['apple', 'pear'] }, 7 : { 'type': 'match', 'values': ['test'] } 6 means column number 6 (cloumn F) will be applied the listed condition.
SHEET_API.addFilter2Span(SHEET_API_HD, [SHEET_API_HD.sheet.getSheetId(), 3, 6, 0, 7], {
6 : {
'type': 'match',
'values': ['test']
},
7 : {
'type': 'match',
'values': ['ok']
}
}, false);