Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Filter spreadsheet via Applescript?

Could anyone kindly provide an Applescript excerpt that would filter a spreadsheet table by (say) whether a text column has a particular string? I haven't been able to find anything via searching. It seems like this could be a very powerful tool for switching between different subsets of data. Thanks for any help!


Mike

Posted on Sep 16, 2014 4:55 PM

Reply
4 replies

Sep 16, 2014 5:48 PM in response to SGIII

Hi SGIII,


From what I can see, Numbers 3.x lets you create an arbitrary number of filters and either apply all or any of them. A second option lets you disable them all.


What I'd like to do is to create a "category" column - let's say with values "a" "b" or "c" - and be able to instantly


- Only see rows of category "a"

- Only see rows of category "b"

...

...

and so on. Much like having Smart List style functionality. I don't mind having one AppleScript for each hard-coded view.


Mike

Sep 16, 2014 6:25 PM in response to MichaelGShapiro

Hi Mike,


Thinking aloud here ...


...AppleScript can see whether a table has a filter set or not, but it can't set a filter.


...Though AppleScript can't set a filter, it can initiate a sort of a table.

...AppleScript can't hide a row but can remove a row.

So it seems the best option would be to grab the values from rows with a particular category and place them in a new table. That's not hard. But it might be a little clunky.

But first, if you just want to be able to instantly see rows that have a given category, have you tried the contextual drop down menu behind the triangle by the column letter (as opposed to using the filter panel at right). That may give you close to what you want.

User uploaded file

That's manual, of course. You mentioned something more automatic like a Smart List. That is possible, not via AppleScript, but by adding an "index" column to the data table and setting up a table with formulas that continually extract values from the data table.

Post more on what you're looking for and we can post potential solutions.

SG

Filter spreadsheet via Applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.