function onEdit(e) { const watchName = "Temp Cost Information"; // Please set the sheet name for the sheet where data will change. const updateName = "Temp WFP"; // Please set the sheet name for the sheet where the filter needs to update. //Constrain onEdit to only watch the sheet we manually update. const watchRange = e.range; const watchSheet = watchRange.getSheet(); if (watchSheet.getSheetName() != watchName) return; //Reapply current filter on sheet we want auto-updated. const updateSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(updateName); const filter = updateSheet.getFilter(); const fRange = filter.getRange(); const criterion = filter.getColumnFilterCriteria(4).copy(); filter.remove(); fRange.createFilter().setColumnFilterCriteria(4, criterion); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter