Export Notes from Kobo eReaders
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.
With the current version (v. 1.0.3, 2015-01-23) of
export_Kobo_notes.py, you can:
- export all your annotations and highlights from your Kobo eReader
- export the annotations and highlights of a book only
- export formats include CSV and human-readable strings
Python, either version 2.x or 3.x, installed on your system to run
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
- If you use Python 3.x, replace
- You must have the Python executable (or a directory containing it) listed in your
PATHenvironment variable, or you need to supply its full path.
- Bear in mind that no official specifications are published by Kobo,
hence the script works as far as my understanding of the database structure of
KoboReader.sqliteis opened in read-only mode, it is advisable to make a copy of it on your PC and export your notes from this copy, instead of accessing the file on your Kobo eReader device.
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!
Pierre-Arnaud Rabier suggested adding the
to extract the annotations and highlights for a single ebook.