Hi! I'm currently reworking my site, so although this content is still online things may change or look odd. Please get in touch to find out how I can help you!
Smile CSV Scraper for FreeAgent and Xero
Are you happy with your bank? I am. I use Smile and they're five-nines awesome - I heartily recommend them to anyone who banks in the UK. The real killer feature - their ethical policy as part of the Co-operative Bank - something all commercial banks should have in my opinion.
One thing they don't do though, is allow you to export your statements in any kind of format - which is kind of a pain for users of services like FreeAgent or Xero as it makes it hard to reconcile your banking transactions. I resorted to copy-pasting the data from the table and reworking the CSV by hand - a bit of a drag to say the least.
No more!
That continued until last week, when I saw a tweet about Aral Balkan's CSV scraper for his HSBC statements - a similar problem, which made me wonder if the code could be converted to work on the Smile statements.
Luckily, Aral is generous enough to share his scraper code under a Creative Commons license, so I got to work and came up with this:
The bookmarklet
Drag the above link into your bookmarks toolbar to create a shiny new bookmarklet:
How to use it
My script works in exactly the same way as Aral's:
- Sign in to your Smile account and navigate to a statement
- Click the "Smile Prepare CSV" bookmarklet
- Click the little "copy to clipboard" icon that appears in the row of buttons above the statement:
- Paste the generated CSV into a plain-text editor
- Save the file with a .csv file extension
- Upload the saved file to FreeAgent or Xero
More info
The CSV generated is in the format described by FreeAgent on their help pages. I'm reliably informed that it will also work with Xero, but you will need to teach Xero what each field in the CSV means the first time you upload.
You can view the source if you want to see what's going on, my comments aren't as entertaining as Aral's I'm afraid but it should be easy enough to see how it works. The first part of the file is just includes, the real code starts at line 323.
Credits & licensing
Really all I've done here is take Aral's work and make a few tweaks, so huge kudos to him for not only coming up with the idea but also being cool enough to share the fruits of his labour under a permissive license.
As such, this code is released under the same license as Aral's - the Creative Commons Attribution-Noncommercial 2.0 UK: England License.
Thanks also to the authors of the components that do most of the heavy lifting, they are:
- jQuery by John Resig
- Clippy by Tom Preston-Werner
- jQuery Flashembed by Brad Robertson
Main image credit: "20 Pounds" by Stephen Davies
Posted on Tuesday, 10th January 2012.
Feedback
Sorry, feedback is now closed on this post, but please feel free to get in touch if you would like to talk about it!