Saturday 26 September 2009

Shout out for OpenCSV

I just wanted to give a shout out to a nice library I stumbled upon when working on my latest Google App Engine for Java project, a site for displaying my running clubs Road Race results for the last few years at http://bsrcroadraceresults.appspot.com.


I have a need to upload a lot of data from old Excel files up into the DataStore. I searched around for an easy way to convert the Excel to a set of annotated POJOs and came across OpenCSV. Turns out to be totally trival to consume a CSV file and use the data to populate the fields of a POJO using standard bean conventions.



Will post a code snippet to show how when back at my dev machine.


Having done the POJO conversion I then used XStream to turn them into an XML file and a little servlet I have been working on to consume the XStream recreating the POJOs on the server and putting them in the DataStore, but more of that later.

No comments:

Post a Comment