function getFilteredColumns(sheet) {
//make a blank array to hold the column positions with applied filter criteria
const filteredColumns = [];
//get the filter on the sheet
const filter = sheet.getFilter();
//if there is no filter on the sheet, return the empty array
if (!filter) {
return filteredColumns;
}
//loop through all of the columns to see if there are any filter criteria
// if there are filter criteria, then add the column position to the array
for (let col=1;col<=sheet.getLastColumn();col++) {
if (filter.getColumnFilterCriteria(col)) {
filteredColumns.push(col);
}
}
//return the array containing the column positions of each column
// with filter criteria applied
return filteredColumns;
}