Working with excel in Java is best done through a previously-written API, such as JExcel.