Skip to content

Instantly share code, notes, and snippets.

@filex
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filex/924de68d55e616a167ff to your computer and use it in GitHub Desktop.
Save filex/924de68d55e616a167ff to your computer and use it in GitHub Desktop.
python script to convert OmniFocus tasklists with notes to an OPML document that OmniOutliner can read.
#! /usr/bin/python
import csv
import sys
from xml.sax import saxutils
tasklist = csv.DictReader(sys.stdin, delimiter=',', quotechar='"')
depth = 0
last_depth = 0
lines = 0;
for row in tasklist:
if row['Type'] in ['Action', 'Project']:
depth = row['Task ID'].count('.')
if lines == 0:
print '<opml><body>'
else:
for i in range(last_depth - depth +1): print '</outline>'
print '<outline text=%s _note=%s>' % (saxutils.quoteattr(row['Name']), saxutils.quoteattr(row['Notes']))
last_depth = depth
lines += 1
if lines == 0:
print >> sys.stderr, "no rows found: %i" % lines
sys.exit(1)
else:
for i in range(depth + 1): print '</outline>'
print '</body></opml>'
@filex
Copy link
Author

filex commented Mar 31, 2015

The script uses OmniFocus CSV export:

  • select desired rows in OmniFocus
  • File -> Export...
  • Save as export.csv
  • ./omnifocus2omnioutliner.py < export.csv > import.opml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment