No matter how Microsoft is doing in comparison with Google, Microsoft Office is still the most used application in software world. Other alternatives like
OpenOffice and
LiberOffice have failed to take off to challenge MS Office. What this mean to a Java application developer? Because of huge popularity of MS office products you often need to support Microsoft office format such as word, Excel, PowerPoint and additionally Adobe PDF. If you are using JSP Servlet,
display tag library automatically provides Excel, Word and PDF support. Since JDK doesn't provide
direct API to read and write Microsoft Excel and Word document, you have to rely on third party library to do your job. Fortunately there are couple of open source library exists to read and write Microsoft Office
XLS and
XLSX file format, Apache POI is the best one. It is widely used, has strong community support and it is feature rich. You can find lot of examples of how to do with
Excel using Apache POI online, which means you will never feel alone and has instant Google support if you stuck there. In this article, we will learn
how to read and write excel files in Java. As I said, Excel files has two popular format .
XLS (produced by Microsoft Officer version prior to 2007 e.g. MS Office 2000 and 2003) and
.XLSX (created by Microsoft Office 2007 onwards e.g. MS Office 2010 and 2013). Fortunately Apache POI supports both format, and you can easily create, read, write and update Excel files using this library. It uses terms like workbook, worksheet, cell, row to keep itself aligned with Microsoft Excel and that's why it is very easy to use. Apache POI also provides different implementation classes to handle both
XLS and
XLSX file format.