Package com.d3x.morpheus.excel
Class ExcelSource
- java.lang.Object
-
- com.d3x.morpheus.excel.ExcelSource
-
- All Implemented Interfaces:
com.d3x.morpheus.frame.DataFrameSource<java.lang.Integer,java.lang.String,ExcelSource.Options>
public class ExcelSource extends java.lang.Object implements com.d3x.morpheus.frame.DataFrameSource<java.lang.Integer,java.lang.String,ExcelSource.Options>
A component used to initialize a DataFrame from the contents of an Excel sheet- Author:
- Xavier Witdouck
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExcelSource.CoordinateDefines a zero-based row and column coordinate in an Excel sheetstatic classExcelSource.OptionsThe options for this source
-
Constructor Summary
Constructors Constructor Description ExcelSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.List<com.d3x.morpheus.array.ArrayBuilder<java.lang.Object>>createValues(int rowCount, int colCount)Returns a list of column array builders to capture data from sheetprivate java.lang.ObjectgetCellValue(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.FormulaEvaluator evaluator)Returns a typed value from the cell specifiedprivate com.d3x.morpheus.array.Array<java.lang.String>getHeader(org.apache.poi.ss.usermodel.Sheet sheet, ExcelSource.Options options)Returns the header array based extracted from the sheetstatic com.d3x.morpheus.frame.DataFrame<java.lang.Integer,java.lang.String>load(java.util.function.Consumer<ExcelSource.Options> consumer)com.d3x.morpheus.frame.DataFrame<java.lang.Integer,java.lang.String>read(java.util.function.Consumer<ExcelSource.Options> consumer)Returns a DataFrames loaded from an Excel sheet according to configured options
-
-
-
Method Detail
-
load
public static com.d3x.morpheus.frame.DataFrame<java.lang.Integer,java.lang.String> load(java.util.function.Consumer<ExcelSource.Options> consumer)
-
read
public com.d3x.morpheus.frame.DataFrame<java.lang.Integer,java.lang.String> read(java.util.function.Consumer<ExcelSource.Options> consumer)
Returns a DataFrames loaded from an Excel sheet according to configured options- Specified by:
readin interfacecom.d3x.morpheus.frame.DataFrameSource<java.lang.Integer,java.lang.String,ExcelSource.Options>- Parameters:
consumer- the consumer to configure options- Returns:
- the resulting DataFrame
-
getHeader
private com.d3x.morpheus.array.Array<java.lang.String> getHeader(org.apache.poi.ss.usermodel.Sheet sheet, ExcelSource.Options options)Returns the header array based extracted from the sheet- Parameters:
sheet- the sheet referenceoptions- the options- Returns:
- the array of header values
-
createValues
private java.util.List<com.d3x.morpheus.array.ArrayBuilder<java.lang.Object>> createValues(int rowCount, int colCount)Returns a list of column array builders to capture data from sheet- Parameters:
rowCount- the initial row count for buildercolCount- the column count for DataFrame- Returns:
- the list of array builders
-
getCellValue
private java.lang.Object getCellValue(org.apache.poi.ss.usermodel.Cell cell, org.apache.poi.ss.usermodel.FormulaEvaluator evaluator)Returns a typed value from the cell specified- Parameters:
cell- the cell referenceevaluator- the formula evaluator- Returns:
- the cell value
-
-