Google Sheets provides a filtering function. However, using Google Apps Script to filter data will automate the process, make it faster to apply on various data sets.

https://yamm.com/blog/create-filters-in-google-sheets-with-google-apps-script/