Export Starling statements to Banktivity and PocketSmith

John Bradshaw
John Bradshaw
Published in
1 min readSep 3, 2018

Moved to -> https://bradshaw.cloud/2018/09/03/export-starling-statements-to-banktivity-and-pocketsmith/

I use Starling Bank but I found that exporting the data on a regular basis to Banktivity or PocketSmith was fairly tricky, as typing in a complex password on a phone to export a CSV, to copy it to shared storage, to copy it from shared storage to my Mac, to import it into the app; to be a fairly tedious process.

You will need to create a developer account, here, and generate your Authorisation token (for which I use Paw to take the grunt work out of testing API calls)

#!/bin/bash
#Convert Starling JSON output to a usable CSV
## Request
curl 'https://api.starlingbank.com/api/v1/transactions/' \
-H 'Cookie: __cfduid=<<YOUR_COOKIE_HERE>>' \
-H 'Authorization: Bearer <<YOUR_BEARER_TOKEN_HERE>>' > starling.json
json2csv -i starling.json -f _embedded.transactions.created,_embedded.transactions.narrative,_embedded.transactions.source,_embedded.transactions.amount -u _embedded.transactions -B -o starling.csv

This uses the json2csv NPM package, available here, and using the following options to configure the right output.

Options:-i, --input <input>                  Path and name of the incoming json file. If not provided, will read from stdin.-o, --output [output]                Path and name of the resulting csv file. Defaults to stdout.-f, --fields <fields>                Specify the fields to convert.-u, --unwind <paths>                 Creates multiple rows from a single JSON document similar to MongoDB unwind.-B, --unwind-blank                   When unwinding, blank out instead of repeating data.

--

--

John Bradshaw
John Bradshaw

Director of Cloud Computing Technology and Strategy EMEA @akamai