Export Notes from Kobo eReaders

IMPORTANT: the project moved to GitHub, this page remains online for historical purposes only!

Abstract

In this page I describe a Python script to export notes and highlights from Kobo eReaders. The script comes in Python 2.x and Python 3.x version, and it works under Linux, Mac OS X and Windows.

Features

With the current version (v. 1.0.3, 2015-01-23) of export_Kobo_notes.py, you can:

Download

Download either export_Kobo_notes.py (Python 2.x) or export_Kobo_notes_3.py (Python 3.x).

You need Python, either version 2.x or 3.x, installed on your system to run export_Kobo_notes.

Usage

First, copy the file KoboReader.sqlite from your Kobo device in the same directory where you downloaded the export script. You can find KoboReader.sqlite in the hidden .kobo/ directory of the USB volume that pops up when you connect your Kobo to your PC via the USB cable.

Then, open a terminal, go to the directory mentioned above, and issue the command:

$ python export_Kobo_notes.py -h

to get the list of available options:

$ python export_Kobo_notes.py [ARGUMENTS]

Arguments:
 -b, --book <title>  : output annotations only for book <title>
 -c, --csv           : output CSV values, instead of human-readable strings
 -f, --file <file>   : <file> is the path to KoboReader.sqlite
 -h, --help          : print this usage message and exit
 -t, --titles        : output a list of book titles with annotations
 -o, --output <file> : write output to <file>

Exit codes:

 0 = no error
 1 = invalid argument(s) error
 2 = file KoboReader.sqlite not found
 4 = provided file is not a valid KoboReader.sqlite db
 8 = output file cannot be written

Examples:

 1. Print this usage message
    $ python export_Kobo_notes.py -h

 2. Print annotations and highlit passages in human-readable form
    $ python export_Kobo_notes.py -f KoboReader.sqlite

 3. As above, but output to file output.txt
    $ python export_Kobo_notes.py -f KoboReader.sqlite -o output.txt 

 4. As above, but output in CSV form
    $ python export_Kobo_notes.py -c -f KoboReader.sqlite

 5. As above, but output to output.csv
    $ python export_Kobo_notes.py -c -f KoboReader.sqlite -o output.csv

 6. Print the list of book titles with annotations or highlit passages
    $ python export_Kobo_notes.py -t -f KoboReader.sqlite

 7. Print annotations and highlit passages for 'The Art of War'
    $ python export_Kobo_notes.py -f KoboReader.sqlite -b 'The Art of War'

 8. As above, but output to output.csv
    $ python export_Kobo_notes.py -c -f KoboReader.sqlite -b 'The Art of War' -o output.csv

Notes

Support and Contribution

The current version runs both under Python 2 or Python 3, and it has been tested under Linux (Debian, Fedora) and Windows (XP, 7). Unfortunately, since I do not have any financial support for the project, I cannot offer support for all the possibile values of the tuple (OS, Python version, console encoding). Therefore, only problems running export_Kobo_notes in a Linux environment will receive full priority.

If you want to contribute some code or you have suggestions, please let me know by sending an email containing the string "export_Kobo_notes" in the subject. Thanks!

Acknowledgments

Pierre-Arnaud Rabier suggested adding the -b and -t switches to extract the annotations and highlights for a single ebook.

Links