Org Mode To Google Docs and Beyond

| foss | software |


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.

Thank you for reading! Share your thoughts with me on mastodon or via email.

Check out some more stuff to read down below.

Most popular posts this month

Recent Favorite Blog Posts

This is a collection of the last 8 posts that I bookmarked.

Articles from blogs I follow around the net

Today in heavy-handed metaphors

Sam Altman is the owner of a massive, invasive, parasitical toxic sludge that respects no boundaries and ruins everything it touches, and that he thinks someone else should clean up. Also his new house has mold. OpenAI CEO's $27 million San Francisco ma…

via jwz July 19, 2024

Weeknotes: GPT-4o mini, LLM 0.15, sqlite-utils 3.37 and building a staging environment

Upgrades to LLM to support the latest models, and a whole bunch of invisible work building out a staging environment for Datasette Cloud. GPT-4o mini and LLM 0.15 Today's big news was the release of GPT-4o mini, which I wrote about here. If you build ap…

via Simon Willison's Weblog: Entries July 19, 2024

ESM3: A simplified primer to the model's architecture

A short primer explaining the architecture of the ESM3 model

via Emmanuel Blogs July 18, 2024

Generated by openring