Python modules for calc

Can you upload your sample file again?

Do you know, how you can call an ARRAY FUNCTION from a CELL RANGE in a spreadsheet document?
.
You must select MORE THAN ONE CELLS for the “target range”, then you must edit the formula, and finally you must hit Shift-Ctrl-Enter.

Here is my new sample file with a Subroutine. A StarBasic Subroutine can modify all of cells in the spreadsheet.
There is a Named range in my sample file. The Sub will get the strings from the first column of the range, and it will put the parsed values into the other columns. Tha Sub is assigned to an event of the Button. It will launch the Sub, because you can not call a Subroutine from a cell.
My Sub uses the getDataArray(), setDataArray() for the range, but you can get/set the cell contents individually too - by API functions.
Parse_Sub_Zizi64.ods (17.2 KB)

Do you know, how you can call an ARRAY FUNCTION from a CELL RANGE in a spreadsheet document?

Did not know that… Will look into it. Thank you for pointing it out.

It works brilliantly, thanks for the [x] Array tip. In a cell start with the formula, enter the formula dialog, check Array. The result is just what I am wanting there.

Can remove the sheet, column, row arguments now, as well.

image

Minor edit, with this approach, it is a bit cumbersome introducing an array formula to the cell range, or working with it after it has been established. Fortunately, it is fairly easy to do the routine spreadsheet fill operation, in this case down, or in whichever direction you want to fill, down or right.

Of course you can create an “array function” with an one dimensional array input range and with a two dimensional array output range. In this case you must call the custom function once for the full range.

1 Like

LibrePythonista uses the custom Python function lp() to interface between Calc and Python. The lp() function accepts Calc objects like ranges, named ranges, and data ranges. You can also directly type references into a Python cell with the lp() function.