Created
September 10, 2015 19:50
-
-
Save ashleyhindle/161b0e3affee8290f3cb to your computer and use it in GitHub Desktop.
qif2csv qif to csv xls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Usage: | |
# gem install qif | |
# ./qif2csv.rb [input.qif] [output.sv] | |
require 'qif' | |
require 'csv' | |
if ARGV.empty? || ARGV.length < 2 | |
puts "Usage: ./qif2csv.rb [input.qif] [output.csv]" | |
exit | |
end | |
qif = Qif::Reader.new(open(ARGV[0])) | |
csv = CSV.open(ARGV[1], "w") | |
csv << ["Date", "Info", "Amount"] | |
qif.each do |transaction| | |
csv << [transaction.date, transaction.payee.to_s, transaction.amount] | |
end | |
csv.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment