Part of my software issues various commands to open and view different file types. For instance I use atril for PDFs and eom for PNGs.
However I have a slight problem with CSV files. I can open them with soffice –calc <filepath> but each time it goes through the Import stage.
Is there a way I can avoid this, to avoid the risk of users creating issues, as the format is consistent and the only separator I need to include is the comma ,?

Thanks in advance.

2 Answers 2


A method to skip importing would be to convert the file to a format that can be read without importing - so for instance:

soffice --headless --convert-to ods --outdir /tmp tblIssues.csv
soffice --view /tmp/tblIssues.ods
rm /tmp/tblIssues.ods

This converts the file tblIssues.csv to a ODS spreadsheet, saves it to /tmp and opens it in Libreoffice. Once it has finished it removes the converted file (optional).

The --view option opens the file as read-only, and also hides the GUI elements needed for editing, making LibreOffice more practical as a viewer.

You could also use other formats, such as PDF (--convert-to pdf) and then you can use another viewer like atril.

Note with I think the libreoffice convert command may use the settings used by the user last in the Importer, so if it is set to use a delimiter other than , it may not work.

Also, you can modify the commands to...

  • hide output:

    COMMAND > /dev/null 2>&1
  • separate from the terminal:

    COMMAND & disown
  • 1
    This worked straight out of the box and is now implemented. Aug 10, 2015 at 8:45
  • Just an observation. If I convert to a speadsheet format, with the correct extension, the soffice --view command opens it up in 'calc' mode. However if it does not have the correct extension it opens it in 'write' mode, even if I use the '--calc' option, but if you click on it with File Viewer it opens in 'calc' mode! Aug 11, 2015 at 8:27
  1. Install unoconv (just once)

    • On Ubuntu run sudo apt-get install unoconv
    • On RHL/CentOS run sudo yum install unoconv
  2. To convert on command-line or batch-mode (non-interactively)

    • unoconv -f pdf /pathto/file.csv /pathto/file.pdf 2>/dev/null



I pipe standard error to /dev/null because I get an error that 'looks' like the conversion failed, but it actually succeeds. When I run unoconv -f csv /tmp/this.csv /tmp/this.pdf an error outputs:

unoconv: UnoException during export phase: Unable to store document to file:///tmp/this.pdf (ErrCode 19468)

But the file is indeed created at /tmp/this.pdf and I've confirmed via pdf viewer the file is perfect.

I am not sure why, but I am guessing the error is because I am not running a listener. Perhaps someone else here will trouble-shoot that ;-)

Anyway, if you need to return an exit 0 from the conversion (e.g. puppet or chef may need that) , then run the convert like this:

unoconv -f pdf /pathto/file.csv /pathto/file.pdf 2>/dev/null || /bin/true

Lastly, unoconv csv conversion defaults to 'comma delimited', which fortunately works out for you. Read the man page to see the import filter options if you want to use different and/or more than one delimiter.

  • You shouldnt provide the 2nd filename, it will automatically read from file.csv and write to file.pdf. Also, the OP might like the -f odt option instead of pdf which produces a real spreadsheet file.
    – meuh
    Aug 7, 2015 at 15:33
  • Appreciate the comments. Yes output file path is optional, but nice to know it can go to a different directory or file name. The OP specifically wanted CSV to PDF format. PDF is the default output. Since you are allowed to mention the (unwanted) -f odt format, I can mention the (unnecessary) output file name ;-)
    – Andrew
    Aug 7, 2015 at 16:59
  • I actually get the same error with no output file created! Aug 10, 2015 at 8:43
  • sorry it didn't work for you - but you got your soffice solution from Wilf - so you're set!
    – Andrew
    Aug 10, 2015 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .