I don't know. With Python you can implement an UNO service with an interface providing this function.
Then you would call that function similar to sheet functions like this:
Code: Select all
oService = createUnoService("MyTools.PyFunctionProvider")
x = oService.callFunction("linecount", sPathName)
-----------------------------
You may also implement this as a sheet function add-in and then call it with the built-in FunctionAccess service:
Code: Select all
oService = createUnoService("com.sun.star.sheet.FunctionAccess")
x = oService.callFunction("MyTools.PyFunctionProvider.linecount", Array(sPathName))
viewtopic.php?f=20&t=95466&p=457840#p457586 has an array function which solves sudoku puzzles like this: =PYSUDOKU(9x9_CellRange) [Ctrl+Shift+Enter] The resulting array is the solved 9x9 range. The function is accessible by c.s.s.sheet.FunctionAccess.
-------------------
It may be possible to install a Python module just like Basic modules, so the code is accessible as a macro via Tools>Macros>.... I don't know and I don't care anymore. I wasted too much life time with stuff like that.