Don't know if anybody has been able to do this yet but this is a function I wrote to get my OFX data into a program from my bank
DISCLAIMER:
It is based on TDBank in Ontario Canada
You pass it a filename ... full path, Returns a 2D Array
Code can probably be fixed up but here is a starting point for you ... written in VS 2022 VB.NET
<pre> Public Function OFXImport(ByVal strMoneyFile As String) As String(,)
Dim intRowsRead As Integer
Dim intArryCol As Integer
Dim aryMSMData(,) As String
Using myMSMReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(strMoneyFile)
myMSMReader.TextFieldType = FileIO.FieldType.Delimited
myMSMReader.SetDelimiters(">")
Dim currentRow As String()
Dim intField As Integer
Dim strTranType As String
Dim blnDebit As Boolean = False
intField = 0
intArryCol = 0
intRowsRead = 0
For intRowsRead = 1 To 41
currentRow = myMSMReader.ReadFields()
Next
intRowsRead = 0
While Not myMSMReader.EndOfData
Try
Dim currentField As String
currentRow = myMSMReader.ReadFields()
For Each currentField In currentRow
If currentField = "<STMTTRN" Or currentField = "</STMTTRN" Then
If currentField = "</STMTTRN" Then
intRowsRead += 1
Else
ReDim Preserve aryMSMData(4, intRowsRead)
End If
Exit For
ElseIf currentField = "</BANKTRANLIST" Then
Exit While
Else
If intField = 0 Then
intField = 1
If currentField = "<TRNTYPE" Then
strTranType = "DC"
ElseIf currentField = "<FITID" Then
intArryCol = 4
strTranType = "POST"
ElseIf currentField = "<NAME" Then
intArryCol = 1
strTranType = "POST"
ElseIf currentField = "<DTPOSTED" Then
intArryCol = 0
strTranType = "POST"
ElseIf currentField = "<TRNAMT" Then
If blnDebit = True Then
intArryCol = 2
Else
intArryCol = 3
End If
strTranType = "POST"
End If
Else
intField = 0
If strTranType = "POST" Then
If intArryCol = 0 Then
aryMSMData(intArryCol, intRowsRead) = currentField.Substring(0, 8)
ElseIf intArryCol = 2 Then
aryMSMData(intArryCol, intRowsRead) = currentField.Substring(1, (currentField.Length - 1))
Else
aryMSMData(intArryCol, intRowsRead) = currentField
End If
Else
If currentField = "DEBIT" Then
blnDebit = True
Else
blnDebit = False
End If
End If
End If
End If
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
End Try
End While
End Using
Return aryMSMData
End Function