Be the first to know and get exclusive access to offers by signing up for our mailing list(s).

Subscribe

We ❤️ Open Source

A community education resource

2 min read

How to batch convert docx files using LibreOffice

Quickly convert docx files into odt, pdf, html, and more.

Years ago, I created dozens of documents using Microsoft Office for graduate school assignments. When I needed to convert those files to a different format without relying on an online tool, open source came to the rescue.

For example, five years ago I took a course where all the documents were provided in docx format. Was there an easy way to convert those files to the open odt format? Absolutely, and it’s simple:

$ libreoffice --headless --convert-to odt *.docx

The above command will convert all docx files in the current directory to odt format.  

Read more: 5 tips to get started on accessibility

But, what if I wanted to convert those same docx files to html so I could easily share them on my classroom website? No problem:

$ libreoffice --headless --convert-to html *.docx

Or maybe I wanted to create PDFs from those documents? Just a slight tweak to the command:

$ libreoffice --headless --convert-to pdf *.docx

Running LibreOffice from the command line inside the folder with your files is straightforward, and the conversion only takes a few seconds depending on your processor and memory.

To explore even more command-line features, use the help attribute:

$ libreoffice --help

This is a perfect example of the power and flexibility that open source software brings to everyday tasks.

More from We Love Open Source

This article is adapted from “The power of LibreOffice” by Don Watkins, and is republished with permission from the author.

The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.

Working on something worth sharing? Write for us.

Contribute to We ❤️ Open Source

Help educate our community by contributing a blog post, tutorial, or how-to.

Two World-class Events

If you didn't make it to All Things AI, check out the event summary, and make plans to join us October 19-20 for All Things Open.

Open Source Meetups

We host some of the most active open source meetups in the U.S. Get more info and RSVP to an upcoming event.