Is there a way to enable data filters by script in a Google Sheet for a certain range? Currently this can be doen manually, but I do not want to select a range, then click \
A short answer would be "No".
It seems that GAS supports neither getting, nor setting Filter criteria for columns, at least according to this open issue.
An alternative solution would be to do the filtering and sorting on GAS side, and push the distinct results into different columns or sheets.