Is it possible for me to make a system call in order to calculate a cell value in LibreOffice Calc?

To clarify, can I set a cell's formula to something like this:

=B3*C4-system("/my/amazing/script B3 C5")

where the contents of cells B3 and C5 would be sent to /my/amazing/script as arguments?

1 Answer 1


AFAIK you can't call external programs from inside a Calc formula directly, but you can define a User-defined function as a "wrapper". This function may use the Shell command to call an external program. This way, you can make a system call "indirectly".

  • This makes Calc immune to this CSV exploit Jan 11, 2018 at 2:35
  • I tried that on Linux but it didn't work. Function VOL(a, b, c) VOL = Shell("/usr/bin/gnome-calculator", 1, a+b+c, false) End Function, then =VOL(1,2,3) produced '0' and didn't run the calculator. Replacing 1 with 4 or false with true didn't help. Jan 11, 2018 at 2:50
  • @DanDascalescu: Generally, it seems that the SHELL() command doesn't recognize STDOUT or the exit code of the executed command. To handle this, you may use the clipboard, as described in this answer. Regarding your example: try Shell("/usr/bin/gnome-calculator", 1, "-e " + a, false), with a as String = "1+2+3". This should open the calculator with the equation 1+2+3 ready to calculate.
    – tohuwawohu
    Jan 11, 2018 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.