Additional Mathematical Functionality for Spreadsheets via Plugins

Suppose a potential user of Only-Office-Desktop-Editors needs some pure functions of numbers or strings or booleans or arrays of such, to use in their spreadsheets, not provided in the immediately usable built-in list of functions such as MIN or COS or whatever.

Right now it seems they are locked out of using Only-Office-Desktop-Editors for their purposes because they can’t simply write such a function as a part of a plugin, and use that.

Some extra API functionality would make this spreadsheet functionality extensible, opening up a world of possibilities. Here’s a minimal way to open this door.

The plugin writer would create a JavaScript function following some documented conventions, taking arguments of the kind listed above and computing — without making API calls — the needed function of those arguments. For example taking string arguments and producing a piece of idiosyncratically formatted text, or taking a series of numbers and computing an array of their elementary symmetric functions. Suppose we call that function F.

When the plugin containing the source of F is loaded, an API call (to a new API function say addExtFunction) that takes F and a string that is some text specifying the types of its argument list and return value (which could be an array) is made in the plugin. The available types in such a “type expression” could be quite restrictive. This has the effect of making F available to be called in a spreadsheet expression.

To make calling such an F as simple as possible, a single extra spreadsheet function can be arranged to do the job for all such calls (say CALLEXT). Then something along the lines of


could be the way to pass F the remaining arguments. This way the space of names of built-in spreadsheet functions would be fixed. To be even more cautious, the plugin name could be used to disambiguate “F” between different plugins should there be a name collision, e.g.


Note that the expected types provided to addExtFunction enable CALLEXT to do some type checking before and after F is called, and complain sensibly and uniformly as appropriate.

Hello @sturt
We need some time to check out this suggestion. I will update this thread when we have something to share.

Hello @Alexandre
Thank you for letting me know.

Hello @sturt
Sorry for the late reply.
We are going to add the possibility of custom functions in v.8.1. the release is planned for this summer. I will update this thread with any changes.

Good news! Thanks for letting me know.

1 Like