Last active
June 23, 2018 17:59
-
-
Save paladiy/02c333cb214162bb1466 to your computer and use it in GitHub Desktop.
unicredit xml to csv
This file contains hidden or 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
require "xmlsimple" | |
def transactions(filename) | |
data = XmlSimple.xml_in(filename) | |
data["LIST_G_CLIENT"][0]['G_CLIENT'][0]['LIST_G_ACC_CURR'][0]['G_ACC_CURR'][0]['LIST_G_TRANS_CARD'][0]['G_TRANS_CARD'][1]['LIST_G_TRANS_DETAILS'][0]['G_TRANS_DETAILS'] | |
end | |
fields = %w(TRANS_DATE_XML TRANS_AMOUNT TRANS_CURR ACC_AMOUNT TRANS_DETAILS ) | |
puts fields.join(", ") | |
transactions("report.xml").each do |transaction| | |
puts fields.map{|field| transaction[field]}.join(", ") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment