This script achieves the following:
- Select rows from the source table where the value in a column is equal to some value.
- Move all selected rows into a another (target) table on another worksheet
- Re-applies the relevant filters on the source table.
There are two variants of the solution. It mainly differs in the way the rows are selected.
- In one script, the rows are selected by applying the table filter and reading the visible range. Script
- In the second, the rows are selected simply by reading the values and extracting the row values. Script
Download the input Excel file used in this sample and try it out yourself!
This is the input Excel file being used.
The solution uses two Office Scripts:

