com.jstatcom.io
Class ExcelHelper
java.lang.Object
com.jstatcom.io.ExcelHelper
public final class ExcelHelper
- extends java.lang.Object
Helper methods for dealing with Excel files.
- Author:
- Markus Kraetzig
Method Summary |
static double[][] |
extractNumberArray(jxl.Workbook w,
int sheetIndex,
boolean firstAsDateCol,
java.util.List<java.lang.Object> firstColList,
java.util.List<java.lang.String> labelsList)
Extracts a double array from an excel sheet. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExcelHelper
public ExcelHelper()
extractNumberArray
public static double[][] extractNumberArray(jxl.Workbook w,
int sheetIndex,
boolean firstAsDateCol,
java.util.List<java.lang.Object> firstColList,
java.util.List<java.lang.String> labelsList)
- Extracts a double array from an excel sheet. It first checks the highest
and lowest row indices with numbers and then extracts all cell data in
between to a number array. All non numbers within are coded NaN.
- Parameters:
w
- the workbooksheetIndex
- index of the sheetfirstAsDateCol
- whether first column should be skipped, often it contains date
codingfirstColList
- list that is filled with elements (usually dates) from the
first column if firstAsDateCol == true
, if
null
then it is ignoredlabelsList
- list that is filled with labels for each column, the first
CellType.LABEL
value in each column is used; if
firstAsDateCol == true
then the first column is
skipped, if null
then it is ignored
- Returns:
- double array with data
- Throws:
java.lang.IllegalArgumentException
- if null argument or invalid sheetIndex