Importing and exporting

Google Tasks Backup supports 2 different Import/Export formats; GTBak and CSV.

Import/Export GTBak format

Files exported from Google Tasks Backup in the Import/Export GTBak format have a filename format of tasks_gtb_XXXXXX.GTBak, where XXXXXX identifies the account name and export date.
The GTBak file uses Python pickle serialisation to ensure that no extended character information is lost or modified (which can happen with the CSV format). This format is not easily editable by humans.
The GTBak format is strongly recommended, especially where tasks may contain international or extended characters, such as accents or special symbols.

Import/Export CSV format

Files exported from Google Tasks Backup in the Import/Export CSV format have a filename format of tasks_import_export_XXXXXX.csv, where XXXXXX identifies the account name and export date.
The file is a Windows-format CSV (comma-separated-values) file, and includes all task properties required to recreate the tasks, including tasklist name and task/sub-task relationships.
The file can be edited in a text editor such as Notepad++ before being imported. Files must be encoded as UTF-8 without BOM, using Windows CR/LF line endings.
It is not recommended to edit the CSV file with a spreadsheet program, as programs such as Excel and OpenOffice Calc tend to corrupt the data.
The import file must observe the following rules;

Cautions when importing;

Table 1: Import file format
Column name Description Required
tasklist_name The name of the tasklist into which the task will be imported.
Tasks may be added to existing or new tasklists, or may replace all the tasks in an existing tasklist, or may even be skipped, depending to the import method chosen when the file is imported. Click on the help icon next to each import method on the main menu for more details.
If a tasklist with that name does not exist, a new tasklist will be created.
Tasks with a tasklist_name of "@default" will be imported into the default tasklist.
Required
title Task title. Required
notes Task notes. May be multi-line, using \n as the line break.
If the task does not have any notes, leave this field blank
Optional
status Can be either "needsAction" or "completed" Required
due If the task has a due date, the date that the task is due, in the format "UTC yyyy-mm-dd"
If the task does not have a due date, leave this field blank
It is strongly recommended that dates start with UTC to reduce the likelyhood of spreadsheet programs changing the date format, however Google Tasks Import will also accept the "yyyy-mm-dd" format for due
Optional
completed If the task has been completed, the date and time that the task was completed, in the format "UTC yyyy-mm-dd HH:MM:SS"
If the task has not been completed, leave this field blank
It is strongly recommended that dates start with UTC to reduce the likelyhood of spreadsheet programs changing the date format, however Google Tasks Import will also accept the following formats for completed; "yyyy-mm-dd HH:MM:SS", "UTC yyyy-mm-dd" and "yyyy-mm-dd"
Optional
deleted If the task has been deleted (see above), the single word "True"
If the task has not been deleted, leave this field blank
Optional
hidden If the task has been hidden (see above), the single word "True"
If the task has not been hidden, leave this field blank
Optional
depth The depth of the task indicates the parent-child relationship between tasks.
Depth is a positive number. Higher numbers indicate greater depth.
Tasks with depth 0 are root tasks.
Optional
Example import/export file;

Note the \n in the multi-line notes in "Second subtask", and the escaped double-quotes in the notes for "Second task"

"tasklist_name","title","notes","status","due","completed","deleted","hidden",depth
"My Tasklist","First task","This is a root task","needsAction","UTC 2012-08-23",,,,0
"My Tasklist","First subtask","This is a subtask of the first task","needsAction","UTC 2012-08-19",,,,1
"My Tasklist","Second subtask","This is a subtask\nof the first subtask","needsAction","UTC 2012-04-21",,,,2
"My Tasklist","Third subtask","This is a subtask of the second subtask","needsAction",,,,,3
"My Tasklist","Fourth subtask","This is a 2nd subtask of the first subtask","needsAction","UTC 2012-07-25",,,,1
"My Tasklist","Second task","This is another ""root"" task","completed",,"UTC 2012-04-22 02:42:36",,,0
This is displayed in Google Tasks as;
{{ app_title }} displays this as;
Task List: My Tasklist - 6 tasks.
[  ] First task
This is a root task
Due: Thu, 23 Aug 2012 UTC
[  ] First subtask
This is a subtask of the first task
Due: Sun, 19 Aug 2012 UTC
[  ] Second subtask
This is a subtask
of the first subtask
Due: Sat, 21 Apr 2012 UTC
[  ] Third subtask
This is a subtask of the second subtask
[  ] Fourth subtask
This is a 2nd subtask of the first subtask
Due: Wed, 25 Jul 2012 UTC
Second task
COMPLETED: 02:42 Sun, 22 Apr 2012 UTC
This is another "root" task

Background information about Google Tasks data

Note that this information is based on my own discoveries and conclusions as at 27 Feb 2012. I hope that this information helps people, but I cannot guarantee the accuracy or completeness of this information. Note also that Google may change their specifications, in which case this information may be out of date.

Understanding tasks data

Most of the task properties are self-explanatory, however the relationship between status, hidden and deleted may require some additional explanation.
Table 2 lists the various states and the corresponding task property values.
Table 2: Task states
Task properties (Note 1)DescriptionVisible in View:
status deleted hidden My order
Sort by date
Completed tasks Trash
(Note 2)
needsActionTo be completed, visible in main windowYesNoNo
completedMarked complete, before clicking [Clear completed]YesYesNo
completedTrueMarked complete, after clicking [Clear completed]NoYesNo
needsActionTrueDeleted incomplete task. Visible only in [Trash]NoNoYes
completedTrueDeleted completed task. Visible only in [Trash]NoNoYes
needsActionTrueTrue ======= Not valid =======
needsActionTrue ======= Not valid =======
completedTrueTrue ======= Not valid =======

Other problems

The completed property has occassionally contained invalid timestamps, where the year is stored as 0000, or as a large negative number such as -1701567. In this case, the application sets the completed property to "1900-01-01 00:00:00", which is the oldest allowed date.
Notes
Note 1 - All 3 properties are stored by Google as strings. The status field may be either "needsAction" or "completed". The deleted and hidden properties can be either an empty string (indicating false), or the word "True".
Note 2 - When tasks are deleted, they are marked as Hidden and moved to the [Trash] view.
According to Google, deleted tasks stay in the Trash (deleted = True) for "some period of time" and are then auto deleted. I have noticed deleted tasks in my Trash that are up to 10 months old. There does not appear to be any way to force a task to be actually deleted. That is, the Trash bin cannot be emptied by the user.

Icons thanks to Visual Pharm, Deleket and Creative Freedom
Popup windows thanks to yendesign