In a previous post, I looked at using the lowriter command to convert word processor files to different formats supported by LibreOffice Writer. That post also included a brief mention of the commands for converting spreadsheets and slide decks.
After publishing that post, another way to convert files at the command line using LibreOffice popped into my memory.
Run this command to do a conversion:
soffice --headless --convert-to [file-format] [file-name].[file-extension]
(You might be wondering about the --headless option. That just stops an empty, and mildly annoying, LibreOffice window from opening on your desktop when you do a conversion.)
You can use that command to convert individual file or do a bulk conversion. If, say, you want to convert a Word file to PDF, use this command:
soffice --headless --convert-to PDF myFile.docx`
For example, use the command below to convert all Microsoft Excel files in a folder to ODS (the format used by LibreOffice Calc):
soffice --headless --convert-to ods *.xlsx
Why use this method instead of the one I wrote about previously? It works with all formats supported by LibreOffice. And you only need to remember one command, rather than the commands for each component of the LibreOffice suite.
— Scott Nesbitt
#linux #cli #opensource #libreoffice