I just recently discovered Google Scripts, and I was wondering if there was a way to sort by a function. For example, if the values in column B were in the range of all real numbers, would there be a way to sort the rows by increasing b^2? Obviously in this scenario it would be the same as sorting by ascending absolute value but this is just an example. I have Java experience so I don’t have a problem writing the actual function, but I just need to get used to all the new functions. I’m already aware range.sort(x) sorts the rows by increasing x, but after a bit of searching I couldn’t find a way to sort by a function of the values in a column.
Also while I’m asking, how do you apply a script to only one tab in a Google Sheets?