If you mean spreadsheet functions
, (user-defined included) - but not general macros - then the answer is no.
Actually, the user-defined spreadsheet function created as macro is able to do that, i.e. if you put =MyFunc("B2")
into A1, the MyFunc can alter the B2. But that’s undesirable side-effect.
Here’s an excerpt from my IRC conversation with moggi (one of lead Calc developers):
* mkaganski: moggi: is it OK that a user function in Calc is able to modify the sheet's content as side effect?
* moggi: mkaganski: normally not, ideally sheet functions are pure functions
* moggi: mkaganski: of course that does not prevent a user to write a function in basic that does not follow that rule
* mkaganski: moggi: so there's no read-only blocking when a user function is executed?
* moggi: mkaganski: no
* moggi: mkaganski: the whole calc core is blocking free, but you can most likely mess up the calculation engine if you change the wrong cell
* moggi: mkaganski: e.g. running into infinite loops, ...
* mkaganski: moggi: I understand. My question is because in such a function, "cSheet.getCellByPosition(5, 5).clearContents(511)" is a noop, while "cSheet.getCellByPosition(5, 5).Value = 5" works...
* mkaganski: moggi: and I hoped that allowing setting value is a bug
* moggi: mkaganski: as I mentioned you can most likely confuse calc a lot if you modify another cell while we are in the calculation of another cell
So, while practically you can create such functions, they are unsupported, not guaranteed to work in a future version, and generally a bad idea.