Ask Your Question

possible to run calc non-interactively? [closed]

asked 2018-03-07 02:45:52 +0200

Phillip_M_Feldman gravatar image

updated 2018-03-07 02:46:30 +0200

I would like to invoke calc so that it runs non-interactively and does the following:

(1) Open the specified workbook.

(2) Modify the values of one or more cells.

(3) Recalculate cells whose values depend on values in cells modified in (2).

(4) Save and close the workbook.

Can this be done? If so, how?

Phillip M. Feldman

Home Page:

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2021-04-23 03:46:18.043846

1 Answer

Sort by » oldest newest most voted

answered 2018-03-08 03:08:35 +0200

Jim K gravatar image

One approach is to run a macro stored in the document or in My Macros. Here is an example in Basic:

Sub ChangeSomeValues
    oDoc = ThisComponent
    oSheet = oDoc.getSheets().getByIndex(0)
    oCell = oSheet.GetCellRangeByName("A1")
    oCell = oSheet.GetCellRangeByName("A2")
End Sub

Then call it like this.

soffice "change values noninteractively.ods" ""

The example document: change values noninteractively.ods

While this is not interactive, the window will still appear. To hide the window, see my answer at

Another approach is to use an external python script or a live python shell. To do this, start LibreOffice listening. A good tutorial is at

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-03-07 02:45:52 +0200

Seen: 158 times

Last updated: Mar 08 '18