Parsing Credit Union MemberDirect Statements

Building on the work I did earlier in the week to automate the download of credit union statements, I’ve now created code to parse those statements and dump the transactions into a MySQL database table.

The memberdirect-parsestatements.php code will ingest a directory full of MemberDirect electronic statements and insert a database record for each transaction. Once you have your transactions in a database, you can then do fun things like this:

SELECT date_format(date,"%Y-%m") AS yearmonth,sum(amount) AS total 
  FROM transactions 
  WHERE amount < 0 AND item = 'CASA MIA' 
  GROUP BY yearmonth

that shows month-by-month spending at Casa Mia.

I’m not sure how much the electronic statement format varies from MemberDirect credit union to credit union, so the script may require tweaking if you’re not using it to parse Metro Credit Union statements.