Skip to content

Instantly share code, notes, and snippets.

@buryat
Created December 26, 2011 09:25
Show Gist options
  • Save buryat/1520803 to your computer and use it in GitHub Desktop.
Save buryat/1520803 to your computer and use it in GitHub Desktop.
VTB24 csv to QIF converter
/*
* @description VTB24 csv to QIF converter
* @usage cat vtb.csv | node vtb_csv2qif.js > vtb.qif
* @url http://en.wikipedia.org/wiki/Quicken_Interchange_Format
*/
var fs = require('fs');
var vtb_csv = fs.readFileSync('/dev/stdin').toString(),
exchange_rate = 31.2575;
var vtb_qif = vtb_csv.replace(
/^"\d*?";"(.*?)";".*?";".*?";".*?";".*?";"(.*?)";"(.*?)"$/g,
function() {
return "D" + arguments[1] + "\nT" + arguments[2] / exchange_rate + "\nP" + arguments[3] + "\n^\n";
}
);
console.log(vtb_qif);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment