Skip to content

Instantly share code, notes, and snippets.

@jystewart
Created July 28, 2009 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jystewart/157597 to your computer and use it in GitHub Desktop.
Save jystewart/157597 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby -w
#
# Paypal CSV to QIF
# By James Stewart - james@ketlai.co.uk
#
# A really simple script attempting to get data from my paypal account (multi currency)
# into Xero. More adjustment will be needed to handle the multiple currencies, but I've
# not found good documentation of how to bake that into the QIF file yet.
#
# (I know paypal do qif output, but it seems to only send transactions from one currency)
require 'rubygems'
require 'fastercsv'
puts "!Type:Cash"
FasterCSV.foreach(ARGV[0], :headers => true) do |row|
puts "D#{row['Date']}"
puts "T#{row['Gross']}"
puts "P#{row['Name']} - #{row['Type']} - #{row['Item Title']} - #{row['Currency']}"
puts "^"
if row['Fee'].to_f != 0.0
puts "D#{row['Date']}"
puts "T-#{row['Fee']}"
puts "PPaypal Fee"
puts "^"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment