Created
December 29, 2016 17:38
-
-
Save jch/fe6155f9bd01564f18cf398e225edcd9 to your computer and use it in GitHub Desktop.
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
# Clean up Mint exported transactions for working with a spreadsheet | |
# | |
# Usage: | |
# | |
# ruby mint.rb <transactions.csv> | |
# | |
# Export a CSV of transactions from Mint | |
# | |
# Tags are not exported, so it must be filtered out before export: | |
# | |
# https://mint.intuit.com/transaction.event?#location:{"query":"-tag:Reimbursable, -tag:Tax Withholding"} | |
# | |
require 'csv' | |
require 'date' | |
csv = CSV.new(ARGF.read, headers: :first_row, converters: [:numeric], return_headers: true) | |
csv.each do |row| | |
# print out headers | |
puts row and next if row['Date'] == 'Date' | |
next unless row['Date'] =~ /2016/ # date converter not working | |
next if ['Transfer', 'Paycheck', 'Credit Card Payment', 'Income', 'Interest Income'].include?(row['Category']) | |
row['Amount'] = -row['Amount'] if row['Transaction Type'] == 'debit' | |
puts row | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment