It's always annoyed me that I can't write a custom function for Numbers. It would make the spreadsheet so much more useful to me. In Google Apps spreadsheets you can do it, using Javascript.

In other words, you write

function myCustomStuff(a, b) { ... }

and a cell can contain:

=myCustomStuff(A1, B2)

Now, in Yosemite, they have Javascript automation. I wonder if it's possible.

1 Answer 1


No - injecting a function looks to be something that isn't easily scriptable.

A simple macro might be doable and you could start with these two references:

This link is the developer documentation on how to connect the script to the Numbers app.

This automation site has for a very long time been the best place I've known to learn and implement AppleScript tools.

If you're new, you could follow the numbers tutorial in AppleScript to make sure you have a workable task and then re-code it in the new language. Then you'd need to determine the hooks in Numbers and see if your specific task is doable without utilizing the Objective-C bridge which allows lower level integration to apps on OS X.

  • I've looked at the Numbers script library and I don't see any way to register a named function for use in equations. You can run a calculation on a bunch of cells and populate other cells. That helps me, but it's not quite what I was after.
    – Rob N
    Commented Nov 14, 2014 at 22:23
  • @RobN I'm going to reverse my yes - I didn't see any way to embed a function and had hoped it was possible, but it sure looks like you'll need to do something very heavy weight like programming a system extension / swizzling the methods in Numbers to inject a function.
    – bmike
    Commented Nov 15, 2014 at 16:01
  • Cool. I accepted your answer, and I've filed a feature request with Apple. Maybe someday.
    – Rob N
    Commented Nov 16, 2014 at 16:43
  • This was 6 years ago - has anything changed? Not that I can find . . . but hoping , . .
    – Steve
    Commented May 10, 2021 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .