I do something similar with excel files. I use the apache poi(http://poi.apache.org/) api to extract data from the uploaded document. It works for excel and csv, not sure about txt, but I imagine that shouldn't be a problem.
I get the data from the attachement and convert it to a ByteArrayInputStream, use that to create a Workbook, get a sheet from it and then parse the data from the sheet into a list of objects.
This was my first attempt at it, so ymmv, but let me know if you need more detail.