How to create filters in Google Sheets using Google Apps Script.
There are lots of ways you can filter data in Google Sheets and in this post Aryan Irani uses SpreadsheetApp.newFilterCriteria()
to create a filter and then copy the filtered data to a new sheet. The post contains everything you need to know to filter data in this way.
Source: Create Filters in Google Sheet using Google Apps Script
Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.