Project Details

BookMaker is a Python script that downloads and formats documents from Google Docs using a set of custom templates for Microsoft Word. This script requires Microsoft Word, an active Google Docs account, and the Python site-packages necessary to interface with both of them.

Status: Testing (News)

Download: Full download - Template Samples

Installation and Operation:
In order for the script to run properly, you must have the following programs installed and configured on your machine:

The archive file available at the link above includes the necessary Python scripts ("BookMaker.py" and "NovelHandler.py") as well as templates for Word (in both the old ".doc" format and the newer ".docx"). You can also grab some sample documents created by BookMaker to show you what the finished product looks like. You can refer to these samples when modifying the templates to match your preference.

Before running the script, open "BookMaker.py" in a text editor and change lines 200 and 201 by providing your Google Docs username and password. Then open the Python interpreter and navigate to the BookMaker installation folder on your hard drive. At the command line, you must enter the following elements, separated by spaces:
  • "python" or PYTHONPATH\python.exe to invoke the Python interpreter
  • "BookMaker.py"
  • The exact title of your Google Doc. If it's more than one word, put double quotes ("") around the title.
  • The name of the template you want to write to. This should be one of the following:
    • "Markup" - double-spaced with wide margins for lots of easy annotation
    • "ReadingCopy" - single-spaced, small font, narrow margins to conserve paper and ink
    • "Submission" - standard manuscript format with typeset-friendly markup for submission to an editor or agent.
    • "HTML" - generates processed HTML as you would see on the Google Docs site for easy portability to your own display website.
A sample command line entry might look like this, then:
  • python BookMaker.py "Gods Tomorrow" ReadingCopy
When you hit Enter, Python will hide any open instances of Word and begin processing your Google Doc. When it's done, it closes the temporary file used for processing and restores Word. You can then open the new Word Document in your BookMaker folder and view it or modify it in Word. Generated Word Documents are automatically labeled with the Google Docs title plus the name of the template used in parentheses, so the above command would have created "Gods Tomorrow (ReadingCopy).doc" in the BookMaker folder.

Known Issues:
  • BookMaker requires some pre-formatting in the Google Docs for optimum performance. It will only recognize chapter headings that start with the word "Chapter".
  • BookMaker discards most non-textual HTML mark-up, preserving only line breaks and italics.
  • Google Docs will sometimes report HTML line breaks ("br") mid-paragraph, which BookMaker mistakes for a new paragraph. These breaks can be overwritten in Google Docs with a fresh space (which corrects the problem in future use of BookMaker), but it's not always easy to spot where the offending line break comes from.
Future Development:
  • Allow HTML formatting without Word or the win32com site package installed.
  • Provide support for OpenOffice.org Writer.
  • Maintain more formatting markup (such as centered paragraphs and bold text)

Back to Aaron Pogue's personal profile