Generic Excel File(XLSX) Reader

com.myjeeva.poi
Class ExcelXSSFRowCallbackHandler

java.lang.Object
  extended by com.myjeeva.poi.ExcelXSSFRowCallbackHandler

public class ExcelXSSFRowCallbackHandler
extends Object

Excel Worksheet Handler for XML SAX parsing (.xlsx document model) http://poi.apache.org/spreadsheet/how-to.html#xssf_sax_api

Inspired by Jeevanandam Madanagopal https://github.com/jeevatkm/generic-repo/tree/master/excelReader

Usage: Provide a ExcelXSSFRowCallbackHandler.ExcelRowContentCallback callback that will be provided a map representing a row of data from the file. The keys will be the column headers and values the row data. Your callback class encapsulates any business logic for processing the string data into dates, numbers, etc to allow full customization of the parsing and processing logic.

Author:
https://github.com/DouglasCAyers

Nested Class Summary
static interface ExcelXSSFRowCallbackHandler.ExcelRowContentCallback
          Callback for processing a single row from excel file.
 
Constructor Summary
ExcelXSSFRowCallbackHandler(File file, ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
           
ExcelXSSFRowCallbackHandler(InputStream inputStream, ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
           
ExcelXSSFRowCallbackHandler(OPCPackage opcPackage, ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
           
ExcelXSSFRowCallbackHandler(String filePath, ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
           
 
Method Summary
 void parse()
          Parses the file, passing each row to the given callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExcelXSSFRowCallbackHandler

public ExcelXSSFRowCallbackHandler(OPCPackage opcPackage,
                                   ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)

ExcelXSSFRowCallbackHandler

public ExcelXSSFRowCallbackHandler(InputStream inputStream,
                                   ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
                            throws InvalidFormatException,
                                   IOException
Throws:
InvalidFormatException
IOException

ExcelXSSFRowCallbackHandler

public ExcelXSSFRowCallbackHandler(File file,
                                   ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
                            throws InvalidFormatException
Throws:
InvalidFormatException

ExcelXSSFRowCallbackHandler

public ExcelXSSFRowCallbackHandler(String filePath,
                                   ExcelXSSFRowCallbackHandler.ExcelRowContentCallback rowCallback)
                            throws InvalidFormatException
Throws:
InvalidFormatException
Method Detail

parse

public void parse()
           throws Exception
Parses the file, passing each row to the given callback. At the end closes the opc package and underling input stream.

Throws:
Exception

Generic Excel File(XLSX) Reader

Copyright © myjeeva.com, All rights reserved.

The copyright of the pages and contents on this website is with myjeeva.com and the content is licensed under Creative Commons Attribution-Share Alike 3.0 Unported License. Libraries and code snippets on myjeeva.com has license information.