Skip to content

Instantly share code, notes, and snippets.

@mberneis
Last active November 12, 2022 22:58
Show Gist options
  • Save mberneis/92a3125949e5e98c992c9f759eb1b062 to your computer and use it in GitHub Desktop.
Save mberneis/92a3125949e5e98c992c9f759eb1b062 to your computer and use it in GitHub Desktop.
Conversion of Todoist Tasks into AmbleNote Notes
<?php
// Conversion of Todoist Tasks into AmbleNote Notes
// Step 1: Export into JSON file using https://darekkay.com/todoist-export
// Step 2: Use this code to convert to multiple markdown files.
// Step 3: Zip Markdown files
// Step 4: Import zip file into AmbleNote
if ($argc<2) {
die ("Please enter filename of todoist json file\n");
}
$todos = json_decode(@file_get_contents($argv[1]));
if (is_null($todos)) {
die("Invalid file\n");
}
// Good to go...
$projects=[];
foreach ($todos->projects as $p) {
$note = "This note contains Tasks from Todoist Project: **{$p->name}**\n\n";
$projects[$p->id] = ['filename' => $p->name.".md", 'note' => $note];
}
foreach ($todos->items as $i) {
$projects[$i->project_id]['note'] .= "- [ ] ".$i->content."\n".$i->description."\n\n";
}
foreach($projects as $p) {
print "Generating {$p['filename']}\n";
file_put_contents($p['filename'],$p['note']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment