Command "libreoffice --calc %U"

I’m editing a launcher - how/what do I add to the command line above to open a particular file?

Did you read your_path_to_the_program/soffice.exe -h (Use “” in place of “/” on Win.) or this help page?
(The help page lists the parameters, but unfortunately the soffice.exe command isn’t clearly described there.)
There is no libreoffice.exe. If your libreoffice is a link to soffice.exe on a Win system then ValidPath\libreoffice.lnk --calc will create a new spreadsheet document.

Here is the updated version of the help page.

Also, in the case when parameters like --calc are given along with file names, no empty file would be created; instead, the --calc would be treated as the component to use when deciding the file’s type (e.g., for RTF or HTML, where we have both filters for Writer and Calc).

@mikekaganski: Assuming the question comes from a Win user, he (f/m) will find on that page
2.Under Windows, type the following text in the Open text field and click OK.
And may try to find the “following text”. Hopefully he is more clever than I am. I failed.

@mikekaganski again now concerning his second comment.
Yes. But that’s only of interest if the file isn’t typed unambiguosly.
A simple way to specifically call the Calc component might be to use scalc.exe instead of soffice.exe.
(From my experience: A correctly marked file belonging to a different component, Writer e.g, would nonetheless be opened with that component.)

@Lupp: agree; just mentioned for completeness.

Found the problem. Calc did not like my long file names. I find that a bit strange because it was Calc that allowed me to create the thing in the first place. When clicking on the file in ‘File Manager’, it happily opens the document and saves it again when I’m finished with it. I wonder what science lies behind that?!

Thanks everybody!

(I’m not a linux user prtesently…)
I don’t think the length of the filename is the problem, but the spaces and special characters in that parody of a files pathname “/home/ken/Documents/Log - Corsa {reg #}.ods”. How should the software analyse it? The dash should announce the next parameter e.g, imo.

@Lupp The file name was created and saved in April 2001 using Libreoffice Calc and has been in regular use ever since. The problem only arose after I recently did a re-install of my system and I’m left wondering How? When? Where? and By whom? The spaces were the only issue - the special characters that I put in were only there to hide a detail that easily identifies me very accurately.

Thanks for your response.

This is another solution…

Libreoffice --calc %U “/home/ken/Documents/Log - Corsa C* *** ***.ods”

Note the quotation marks. Now that is a detail that I had entirely forgotten. I think it was Ossie Osbourne (Black Sabbath) who said “Of all the things I’ve lost, I miss my mind the most!”


It is an educated guess that this is a Linux system. On Mint, if I add a menu item (say Calc) to the Panel, it creates a Launcher with this command:

libreoffice6.1 --calc %U

To modify that to open a specific document, add to the end of this command a specific file name and its’ location:

libreoffice6.1 --calc %U /home/YOUR_DIRECTORY/YOUR_FILE_NAME.ods

Clicking on the launcher then opens that document. The problem is that each time LO is upgraded beyond version 6.x, the launcher needs to be modified. Of course the same is true if you execute using soffice as it is located in a directory specific to the LO version. Using soffice can also be complicated further if using OpenOffice on the same system.


the notation of:

libreoffice --calc %U

in the question indicates this may involve an older version of LibreOffice. LO version & OS should always be specified in a question.

@MojoDog The problem with your command are the spaces in the file name. Change this:

libreoffice --calc %U /home/ken/Documents/Log - Corsa {reg #}.ods


libreoffice --calc %U /home/ken/Documents/Log\ -\ Corsa\ {reg\ \#}.ods

This is placing a \ prior to each space & # in statement.

Spaces & special characters in names are always a problem.

I found that (eventually!), thanks! I’ve done it the ‘old’ way for ages - I started the spreadsheet in question in 2001 and the name has never changed. A bit weird that there should now be a sensitivity to the spaces?!
Thanks again.

(I am a linux user.) I entered the --calc U% option which gives me a blank spreadsheet. I then enter the full path to the file and the name of the file thus “libreoffice --calc %U /home/ken/Documents/Log - Corsa {reg #}.ods”.

Calc fires up as if going to start but then immediately crashes - no apology - very rude!

The method above worked for a long time but then I had a rush of blood to the head and re-installed my entire system. I thought I had all bases covered - apparently not!

I appreciate the responses!!

Please use comments or edit edit original question. Answers should be for responding to original question. Also please do mot check post as wiki for questions or answers as it helps no one.

Thanks for the heads-up. Must tell you though, I didn’t even see ‘post as wiki’ so I’m totally unaware of checking it. I’ll watch for it!

@MojoDog That check box is here, right before you click Ask Your Question:

[enter your question, then submit as follows…]

Oh good grief! There it is, large as life, and I missed it! I’m humbled! Thanks for that!