Programmatically Manipulating Microsoft Excel Spreadsheets with the Apache POI API - Let’s Learn How to Read From a Spreadsheet
(Page 3 of 4 )
While the Apache POI allows us to write to spreadsheets, it also allows us to read from them. In the code shown in
Listing 2, we do just that, reading off the values of our states and their corresponding sales figures and directing them to the system console. You’ll notice how much of our code is similar to that of
Listing 1. We again open our spreadsheet, which we specify is located at
c:articlessales.xls.
HSSFCell and
HSSFRow objects are used to narrow and house the cells we want to read data from. We then use the
getStringCellValue and
getNumericCellValue methods to extract the cell data and display it to the console.
Next: Conclusion >>
More Apache Articles
More By Kulvir S. Bhogal