Import / Migration

This is a best effort list on how to import your tasks from other task managers to TaskLite.

YAML File

If you have all you tasks in one YAML file like this:

- id: 123
  body: Buy milk
  tags: [groceries]

- id: 456
  body: Go running
  tags: [sport]

Run following command to import it. Be sure to make yaml2json available in your path and to install jq first.

cat tasks.yaml \
| yaml2json \
| jq -c '.[]' \
| while read -r task
  do
    echo "$task" | tasklite importjson
  done

Taskwarrior

TaskLite supports all fields of Taskwarrior's export format. Therefore migration is really simple:

task export rc.json.array=off \
| while read -r task; \
  do echo $task | tasklite importjson; \
  done

Google Tasks

There is currently no proper way to export tasks.

A workaround is:

  1. Open the standalone view of Google Tasks
  2. Select all text with cmd + a and copy it
  3. Paste it in a text editor
  4. Format it properly
  5. Import it with a while loop as seen in the Taskwarrior section

Google Keep

You can export all tasks / notes from Google Keep via Google Takeout. It provides a Takeout/Keep directory with one .html and .json file per task.

To import the .json files, change into the directory and run following command:

find . -iname '*.json' \
| while read -r task
  do
    jq -c \
      '.textContent as $txt
        | .labels as $lbls
        | .title as $title
        | (if .isArchived then "done"
          elif .isTrashed then "deletable"
          else null
          end) as $state
        | {
            utc: .userEditedTimestampUsec,
            body: ((if $title and $title != "" then $title else $txt end)
              + (if .listContent
                then "\n\n" +
                  (
                    .listContent
                    | map("- [" + (if .isChecked then "x" else " " end) + "] "
                      + .text)
                    | join("\n")
                  )
                else ""
                end))

          }
        | if $lbls then . + {tags: ($lbls | map(.name))} else . end
        | if $title and $title != "" and $txt and $txt != ""
          then . + {notes: [{body: $txt}]}
          else .
          end
        | if $state then . + {state: $state} else . end
      ' \
      "$task" \
    | tl importjson
  done

The title of the Google Keep note becomes the body of the task and the note itself becomes a TaskLite note attached to the task. A list of sub-tasks will be converted to a GitHub Flavored Markdown task list.

Telegram

Telegram's "Saved Messages" -- a.k.a. messages to oneself -- are a pretty convenient inbox. Here is how to move them to TaskLite afterwards:

  1. Install Telegram Desktop brew install telegram-desktop

  2. Go to "Saved Messages"

  3. Click on 3 dots in the upper right corner

  4. Click on "Export chat history"

  5. Deselect all additional media and select "JSON" as output format

  6. Approve download on a mobile device

  7. Download the JSON file (if download window was closed, simply follow the previous steps again)

  8. Either import it directly as JSON or convert it first to YAML for cleanup.

    Import JSON directly:

    cat result.json \
    | jq -c '
      .messages
        | map(
            (if (.text | type) == "string"
            then .text
            else (.text
                | map(
                    if (. | type) == "string"
                    then .
                    else .text end
                  )
                | join(", ")
              )
            end) as $body
            | {
              utc: .date,
              body: $body,
              tags: ["telegram"]
            }
          )
        | .[]
      ' \
    | while read -r task
      do
        echo "$task" | tasklite importjson
      done
    

    Convert it to YAML for easier cleanup:

    jq '.messages' result.json | yq --yaml-output > out.yaml
    
  9. Clear chat history on Telegram

Apple Reminders

Use following Apple Script to display the reminders including their creation timestamp. Seen at https://discussions.apple.com/thread/8570915.

use scripting additions

set rnames to {}
set cdates to {}
set fmt to ""

tell application "Reminders"
  launch

  try
    set theRemList to text returned of (¬
      display dialog "Enter the Reminder list name" ¬
        default answer "" with icon note¬
    )

  on error errmsg number errnbr
    if errnbr is equal to -128 then
      display alert "User cancelled... ending." giving up after 10
    end if

    return
  end try

  set {rnames, cdates} to {name, creation date}¬
    of every reminder of list theRemList
end tell


repeat with i from 1 to number of items in rnames
  set fmt to fmt & (item i of rnames) & " : " & (item i of cdates) & return
end repeat


tell application "System Events"
  display dialog fmt as text with title "Reminder Items Creation Dates"
end tell

return
  1. Copy and paste it into a tasks.json file
  2. Format it as proper JSON and manually add notes, and tags fields
  3. Import JSON file:
    cat tasks.json \
    | jq -c '.[]' \
    | while read -r task
      do
        echo $task | tasklite importjson
      done