batch-convert document formats

February 8, 2017 - Reading time: 4 minutes

Install the latest LibreOffice and it's library
On most Ubuntu version LibreOffice is defaulty installed, just upgrade it to the latest version.

  • apt-get install libreoffice

Install unoconv
unoconv is a command line utility that can convert any document format (doc, docx. odt, ods, xls, xlsx) that LibreOffice can import, to any file format (xml, pdf, doc, docx. odt, ods, xls, xlsx) that LibreOffice is capable of exporting.

  • apt-get install unoconv
Installing LibreOffice is more than enough to answer your needs in converting document, but for some reason unoconv do better (despite using the same library) when the output is use by other application, we can say it more acceptable.

Batch Convert Document to csv, pdf, jpg, docx, xlsx, odt, or ods

To batch convert document you have to work under terminal, prepare a document that will be converted in a folder (can be consist of several sub-folders),  then do following :

Synopsis :

  • unoconv [options] to-file from-file

Convert single xls format to pdf

  • unoconv -f pdf some-document.xls

Convert single png format to jpg

  • unoconv -f jpg some-document.png

Batch Convert docx format to pdf

  • unoconv -f pdf *.docx

Batch Convert xlsx format to ods

  • unoconv -f ods *.xlsx

Batch Convert csv format to xlsx

  • unoconv -f xlsx *.csv
Batch Convert csv format to ods
  • unoconv -f ods *.csv

You can change the option, source, and destination format according to your needs. Some document format  which supported by the this application are pdf, odf, odt, ods, xls, xlsx, doc, docx, rtf, ppt, pptx, csv, png, jpg, bmp and svg.