This is a program to export the Google Tasks data from your Google account to a JSON file, or just print them in the terminal.
To use GoogleTaskExport, you'll have to register an application with Google and obtain a client secret file.
- Create a Google Cloud Project.
- On the Enabled APIs & services page, choose Enable APIs and Services, search for Google Tasks API and choose Enable.
- On the Google Tasks API page, click Create Credentials.
- On the Which API are you using? step, choose User data.
- On the OAuth Consent Screen step, configure it whatever you want.
- One detail to remember is not to use the
Google
name in the application name. See here for more details.
- One detail to remember is not to use the
- On the Scopes step, choose Google Tasks API (the one with the
.readonly
suffix),https://www.googleapis.com/auth/tasks.readonly
. - On the OAuth Client ID step, choose Desktop app. Specify the name as
GoogleTaskExport
. - Download the resulting JSON file.
- Remember to add the users you want to use the application on the OAuth consent screen page, in the Test users list.
Use the following shell command:
$ dotnet run --project GoogleTaskExport -- [json|print] <userName> <path to the JSON credential file>
Here, <userName>
is the user email, e.g. [email protected]
.
This command will fetch all the stored Google Tasks (including the completed ones, but omitting the deleted ones) and output them in the specified format.
Note that on the first run, it will open a browser window to ask you to grant the application access to your Google Tasks data.
If you want to flush the credential cache, delete the <homePath>/Google.Apis.Auth
directory (or inspect the files and delete only the ones you want to flush; note that this is the default location for Google API libraries, so other programs may store their authentication tokens there as well), where <homePath>
is %APPDATA%
on Windows.