# How to (batch) convert Microsoft Office Files from commandline? [closed]

Hello,

I'm using LibreOffice 3.4 on Fedora 16. I want to batch convert lots of .xls/x, .doc/x, and .ppt/x files to plain text.

1. When I issue the following command to just try to convert a single file, the command fails silently with an exit code of 1.

$soffice.bin --headless --convert-to txt foo.xls$ echo $? 1$

2. I'd also like to know how to efficiently convert a whole bunch of these files without starting and stopping LibreOffice everytime. It appears that the --accept argument may be the way, but there seems to be no example of this anywhere. Would greatly appreciate if you could share one.

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by Alex Kemp close date 2015-11-02 19:22:40.970689

Sort by » oldest newest most voted

Close down all LO instances and it works (tested)

more

( 2012-02-25 04:58:25 +0100 )edit

Wow, I had racked my brains for many hours with this issue, by trying powershell scripts and some downloaded Windows crapware.

Finally Libre Office and Linux showed the way via this forum.

BTW, with the later version of LO under Ubuntu, the command line changes to this:

Worked a treat.

Sheer genius, I thank you all so very much

( 2015-07-09 13:05:04 +0100 )edit

In the terminal, use the following command to batch convert Microsoft Office documents into Libreoffice ones.

soffice --headless --convert-to odf *.doc --outdir YourOutputDirectoryHere/

Libreoffice is awesomeness, FYI.

more

Cool! Thanks for the command line! One could run "*.doc*" to get both DOC and DOCX in one pass, if that wildcard didn't get some unwanted hits. Also, it looks like that bug mentioned by @drone27of1 is still a problem: fdo#37531 (and when I first ran the string from cli, I got nothing!).

( 2013-06-19 19:10:27 +0100 )edit

Can't speak to the batch capabilities off hand, but as your looking for a command line tool, the first thing that comes to mind is AntiWord. It supports Word files up to MS Office 2003. Unfortunately, if it's not in your repos the RPM links on that page are all out of date (latest version is 0.37 from 2005). I had to build it from source myself recently. I've always found it to work quite well, but I only use it in combination with less for older *.doc files.

Anyway, I hope I've given you a step forward and not fed you a red herring.

more