To convert American Express CSV to QIF

Michael DeBusk mdebusk at gmail.com
Mon Oct 27 16:38:51 EDT 2014


Some time back, I found that I could no longer download QIF files from
American Express. I could, however, get a CSV. The following is my
first shot at a one-liner to convert that particular CSV to QIF.

cat ofx.csv | sed -e 's/\"//g;s/Reference\:\ //g;s/ \{1,\}/ /g'
ofx.csv | awk -F, '{ print "D" $1; print "N" $2; print "T" $3; print
"P" $4; print "M" $5; print "LExpenses:&&"; print "^"; }' > amex.qif

It's not perfect, but since I can barely scratch the surface of awk
and sed, it'll do. I haven't found that it ruins anything. If anyone
can improve upon it, I'd be grateful.

(The last awk instruction to print "LExpenses:&&" creates an account
placeholder for me in each transaction. I go in and edit the QIF
afterward, replacing "&&" with the appropriate account name.)

--
()  ascii ribbon campaign     * against html e-mail
/\  www.asciiribbon.org       * against proprietary attachments
Home: http://nlphilia.com     * Blog: http://nlphilia.net
Registered Linux User #450983 * Ubuntu Counter Project #10548


More information about the gnucash-user mailing list