Cant get soffice.exe to go with command line with "-o filename.xlsx" option

Running Windows 10 x64 with Libreoffice I am wanting (while in Windows 10) to start librecalc from cmd line. Will eventually want to do this from a python script.

I was using several way of using the cmd “C:\Program Files\LibreOffice\program\soffice.exe” “–calc -o ttt.xlsx”. It also fails with just the “-o ttt.xlsx” option by itself. When I issue the command, it fails by opening a terminal-like window with error message "Error in option: -o {filename} and help text

Librcalc does start with just the “–calc” option, but seems to fail with the “-o filenname” option. I can successfully open Librecalc with a file using Ubuntu - but need to get this to work wunder windows.

What command should I use to open librecals and edit filename.xlsx? How can I get this to work?


the following .bat scripts works for me (using path %Temp% here for data privacy reasons - of course you need to adapt to your specific document location).

@echo off
"%ProgramFiles%"\LibreOffice\Program\soffice --calc -o "%Temp%"\ttt.xlsx

Please notice the quotes surrounding variables, which may contain spaces.

Tested using

Windows 10, 21H1,  19043.1023

Version: (x64), Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 1; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-US (en_DE); UI: en-US
Calc: threaded

Just a note that usual convention is to enclose the entire argument into quotes, not only some part of it; so it’s usually "%ProgramFiles%\LibreOffice\Program\soffice" and "%Temp%\ttt.xlsx".

I know the convention, but never understood why. And now I understand why and it is just due to spaces (taken from my testing) and that’s the point I took from the question, which seems (! - to me) to indicate OP used "--calc -o ttt.xlsx" (quoting option as well, and this way showing to have the same problem as myself some time ago)…

Anyway, sorry if I completely misunderstood the question in this regard.