Org Mode To Google Docs and Beyond


The other day I was attempting to make a structured document. It has been years since I have done this and I have forgotten what a pain in the ass most word processing software is. When I used to work for a .NET enterprise health care company, I would often find myself in “Word Hell” with no hope of ever returning. This time I found myself in a new place, Google Docs Hell. It’s similar to Word hell, but runs in the cloud. All that I was really trying to do was create a document with numbered headings and a simple table of contents that links to said headings. I suppose that this is too much to ask for because although I was able to get my headings to work more or less, as soon as I tried to add content under the headings Google Docs decided that I really wanted random page breaks after every heading. After banging my head against the wall for a few minutes, with no clue on how to even begin to troubleshoot this issue, I busted out my trusty old friend Emacs. Emacs Org Mode has never failed me. I remember back in college when I needed to add code snippets or non-trivial equations into a document that I was working on, and this was a seemingly impossible task in any word processor that I found. Org Mode is well suited for this type of task since it is a plain text system, and in my experience plain text combined with a sane “compiler” is the only way to truly have WYSIWYG. Other native WYSIWYG editors like Word, Pages, Google Docs, and even LibreOffice are very complex pieces of software, so figuring out why a random page break is being inserted in the middle of an ordered list is only possible if you have no value for your time.

Enabling Org Mode Exporting to ODT

Recent versions of Org Mode are capable of exporting directory to ODT format, and it works more or less very well, but the documentation is not the greatest. For instance, this page says:

The ODT exporter relies on the zip program to create the final output. Check the availability of this program before proceeding further.

But it does not really tell you what zip really is. I am assuming its whatever is in my $PATH on OS X, but I can’t really be too sure.

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:

Also, no where in the docs does it tell you how to enable ODT exporting. In order to be able to export to ODT like you would export to any other format using the C-c C-e export menu, you need to explicitly enable ox-odt somewhere in your org-mode configuration file. Check out my .emacs.d repo for an example, but essentially adding this somewhere in your startup scripts should do the trick:

;; Load ODT backend to allow for exporting to open document format.
(require 'ox-odt)

Exporting to ODT

With all of that out of the way, we are free to start exporting things to ODT. Fire up org mode and write your document to your hearts content. When you are finished you can export it to ODT with C-c C-e o o. Opening up this file in LibreOffice or OpenOffice should show you a really nice representation of whatever you just wrote. The best part about this method is that you get a table of contents, and section numbering for free. In addition, you do not have to keep track of the numbers yourself, if you need to move stuff around or add new sections then org mode export will automatically update the numbering for you. Besides being able to export to ODT, org-mode also supports exporting to about a dozen other formats. If you have LaTeX and pandoc installed then the sky is truly the limit.

Uploading to Google Docs

While the editing capabilities of Google Docs are suspect, it is difficult to argue that its not one of the best tools for collaborating with your team. Unless you are writing a manifesto in a cabin, you likely want to share your latest creation with your team for feedback. I would not recommend uploading the ODT directly to Google Docs, since the formatting can get a bit thrown off. Instead I suggest exporting the file from LibreOffice into .doc or .docx and then uploading that. From my preliminary experiments this seemed to work the best.


If you are writing a complex structured document, especially one with formulas or code snippets. You will be hard pressed to find a better environment than Emacs with org-mode. Enabling the ODT export in org-mode makes it fairly simple to upload your documents to Google Docs and be able to collaborate with your team.


  1. Thanks for writing about this capability of org-mode; I’ve wondered why ODT export and Markdown export haven’t been included by default and enabled by org-mode for the last few years. They’re immensely useful and though collaboration is more difficult with org (can’t get everyone to use emacs!) for the first draft or the solo writer/developer, it’s invaluable.

    1. Thanks for the comments Rudolf, I couldn’t agree with you more.

      I am not sure how actively developed org-mode is anymore, its been pretty stable for a long time. Making a built in export would probably not be too difficult, but I also wonder if they are trying to follow the unix philosophy of “doing one thing well”.

  2. Thank you for your post! I’ve previously been exporting from org to html and then either opening the html file in google docs or copying from rendered html – each kinda worked, but looked weak / had problem with lists and required manual fix-ups afterwards.

    But exporting to .docx seems to work the best – out of the box I’m satisfied, thanks! In return – you can specify the .docx to be the direct result of .odt export. This way you’ll have one manual step less – just use this:
    (setq org-odt-preferred-output-format “docx”)

    You can read more in this org manual entry:

  3. Thanks for writing this up.

    When I open my exported docx as a Google Doc, all of the headings have bookmarks attached. This is an annoying/unnecessary visual distraction for many cases. Does anyone have a way to strip the bookmarks on export?

  4. I wonder why said software, like Google docs, is not text based? Why isn’t the underlying foundation css or at least something text based. I wonder about the design decision here

Leave a Reply