Created
September 18, 2020 00:01
-
-
Save crossan007/ef14d833d0c6c34d8a0c32d86df5c7d6 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
$CSVFileName = "transaction_activity.csv" | |
$EZPT = Import-CSV $CSVFileName | |
$OFXString = 'OFXHEADER:100'+ "`n" + | |
'DATA:OFXSGML'+ "`n" + | |
'VERSION:102'+ "`n" + | |
'SECURITY:NONE'+ "`n" + | |
'ENCODING:USASCII'+ "`n" + | |
'CHARSET:1252'+ "`n" + | |
'COMPRESSION:NONE'+ "`n" + | |
'OLDFILEUID:NONE'+ "`n" + | |
'NEWFILEUID:NONE'+ "`n" | |
$OFXString += '<OFX>' | |
$OFXString += '<SIGNONMSGSRSV1><SONRS><STATUS><CODE>0<SEVERITY>INFO</STATUS><DTSERVER>NOW<LANGUAGE>ENG<FI><ORG>CHARLES<FID>12345</FI></SONRS></SIGNONMSGSRSV1>' | |
$OFXString += '<BANKMSGSRSV1>' + | |
'<STMTTRNRS>' + | |
'<TRNUID>' + | |
'<STATUS>' + | |
'<CODE>0' + | |
'<SEVERITY>INFO' + | |
'</STATUS>' | |
foreach ($transaction in $EZPT) { | |
if ($transaction.TRANSACTION -ne "CC REPLENISHMENT") | |
{ | |
$OFXString += '<STMTRS>' + | |
'<CURDEF>USD' + | |
'<BANKACCTFROM>' + | |
'<ACCTID>Assets:Other:EZ PASS</ACCTID>' + | |
'</BANKACCTFROM>' | |
$OFXString += | |
'<STMTTRN>' + | |
'<TRNTYPE>CREDIT' + | |
'<DTPOSTED>'+ $(Get-Date $transaction.'POST. DATE' -format "yyyyMMdd") + | |
'<TRNAMT>'+ $transaction.AMOUNT + | |
'<NAME>' + $transaction.TRANSACTION + "</NAME>" + | |
'<MEMO>' + $transaction.'ENTRY PLAZA' + " -> " + $transaction.'EXIT PLAZA' + "</MEMO>"+ | |
'<BANKACCTTO>' + | |
'<ACCTID>Expenses:Transportation:Tolls</ACCTID>' + | |
'</BANKACCTTO>' + | |
'</STMTTRN>'+ | |
'</STMTRS>' | |
} | |
} | |
$OFXString += '</STMTTRNRS></BANKTRANLIST></OFX>' | |
$OFXString | Out-File "$CSVFileName.ofx" -Encoding ascii |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment