Ask Your Question

Command "libreoffice --calc %U"

asked 2018-10-26 23:59:14 +0200

Mojo Dog gravatar image

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

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2018-10-27 12:03:41 +0200

Lupp gravatar image

updated 2018-10-27 12:29:44 +0200

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.

edit flag offensive delete link more


Mike Kaganski gravatar imageMike Kaganski ( 2018-10-27 12:14:44 +0200 )edit

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).

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-27 12:32:50 +0200 )edit

@Mike Kaganski: 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.

Lupp gravatar imageLupp ( 2018-10-27 12:34:45 +0200 )edit

@Mike Kaganski 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 gravatar imageLupp ( 2018-10-27 12:46:47 +0200 )edit

@Lupp: agree; just mentioned for completeness.

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-27 12:56:58 +0200 )edit

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! Ken.

Mojo Dog gravatar imageMojo Dog ( 2018-10-28 20:39:34 +0200 )edit

(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 gravatar imageLupp ( 2018-10-28 21:06:58 +0200 )edit

@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.

Mojo Dog gravatar imageMojo Dog ( 2018-10-28 21:52:07 +0200 )edit

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!"

Mojo Dog gravatar imageMojo Dog ( 2018-10-28 22:32:15 +0200 )edit

answered 2018-10-27 18:53:58 +0200

Ratslinger gravatar image

updated 2018-10-27 19:12:39 +0200


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.

edit flag offensive delete link more


@Mojo Dog 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.

Ratslinger gravatar imageRatslinger ( 2018-10-28 19:57:36 +0200 )edit

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.

Mojo Dog gravatar imageMojo Dog ( 2018-10-28 20:47:55 +0200 )edit

answered 2018-10-28 19:17:27 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

(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!!

edit flag offensive delete link more



@Mojo Dog 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.

Ratslinger gravatar imageRatslinger ( 2018-10-28 19:55:31 +0200 )edit

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!

Mojo Dog gravatar imageMojo Dog ( 2018-10-28 20:29:44 +0200 )edit

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

[enter your question, then submit as follows...]

EasyTrieve gravatar imageEasyTrieve ( 2018-10-28 21:37:26 +0200 )edit

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

Mojo Dog gravatar imageMojo Dog ( 2018-10-28 22:00:37 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-10-26 23:59:14 +0200

Seen: 1,095 times

Last updated: Oct 28 '18