Things3 database -> Markdown conversion script.
pip3 install -r requirements.txt
Copy .env.example
to .env
and set:
- Required:
THINGS_DB
= the path to your Things3 sqlite database file, for example:"~/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/ThingsData-X342B/Things Database.thingsdatabase/main.sqlite"
- Optional:
SKIP_TAGS
= a comma-separated list of tags for any tasks you do not want included in output, for example:"personal,pers"
Run without any parameters to see the full list of arguments available:
--debug If set will show script debug information.
--due If set will show incomplete tasks with deadlines.
--format {import} Format mode. Import: Outputs tasks as headings, notes as body text, subtasks as bullets.
--gcallinks If provided, appends links to create a Google calendar event for the task.
--groupby {date,project}
How to group the tasks
--orderby {date,index,project}
How to order the tasks
--range RANGE Relative date range to get completed tasks for (e.g., "0 days ago", "1 day ago", "1 week ago",
"this week" which starts on Monday). Completed tasks are relative to midnight of the day requested.
--simple If set will hide task subtasks + notes and cancelled tasks.
--tag TAG If provided, only uncompleted tasks with this tag are fetched.
--today If set will show incomplete tasks in Today.
The --due
, --range
, --tag
, or --today
parameter is required, at a minimum.
Notes:
- nothing will be returned if no tasks match the given arguments; and
- any tasks tagged with any tags in
SKIP_TAGS
as defined in.env
are not included in the output.
Show tasks completed within the last week, grouped by project, ordered by project:
python3 things2md.py --range "1 week ago" --groupby project --orderby project
Show tasks completed today:
python3 things2md.py --range "today"
Show tasks completed today, and omit subtasks, notes, and cancelled tasks:
python3 things2md.py --range "today" --simple
Show tasks completed yesterday:
python3 things2md.py --range "yesterday"
...and ordered by project, but omit subtasks, notes, and cancelled tasks:
python3 things2md.py --range "yesterday" --orderby project --simple
Show tasks completed in the last 3 days, and omit subtasks, notes, and cancelled tasks:
python3 things2md.py --range "3 days ago" --simple
Show tasks completed in the last week, ordered by project, but omit subtasks, notes, and cancelled tasks:
python3 things2md.py --range "1 week ago" --orderby project --simple
BETA: Show uncompleted tasks in Today.
python3 things2md.py --today
To further narrow down tasks to be done, I tag them with a special tag and retrieve just those tasks:
Show uncompleted tasks, tagged with "focus", ordered how they're ordered in Things (though Evening tasks seem to show at the top), and show links that you can click to create a Google Calendar event:
python3 things2md.py --tag "focus" --orderby index --gcallinks
Show uncompleted tasks with deadlines set, and those deadline dates, ordered by deadline:
python3 things2md.py --due
I frequently draft notes in Things that I just want to get it out as simple markdown.
Show uncompleted tasks, tagged with "import", formatted in markdown with task names as headers, notes as body text, and subtasks as a list:
python3 things2md.py --tag "import" --format import --orderby index
This script was designed for use in Obsidian for Daily Notes, but as it outputs plain text as markdown, it really can be used anywhere you can run a Python script.
I call this script via the shell commands community plugin. Recommended configuration as follows:
- Add the command per the above example. Make sure your path to the things2md.py script is absolute.
- Click the gear icon for each command, and adjust these settings:
- In the General tab, set an alias for the command. For example, tasks_today (You'll execute this from a slash command.)
- In the Output tab, under Output channel for stdout set it to Current file: caret position
- obsidian-things-logbook - This is an Obsidian plugin that periodically syncs the Things logook with your Obsidian vault. This wasn't the behavior I was looking for, hence why I developed
things2md
. - things.py - Had I done more research first, I may have maybe used this instead of writing my own script, but I'm definitely learning from it now! For example, how some dates are stored.
- things.sh - I found this shell script late in the development of
things2md
, but it looks like another good interpretation of how to query the Things database.