public class ExcelReader extends AbstractReader
| Modifier and Type | Class and Description |
|---|---|
static class |
ExcelReader.FailedExpressionStrategy
Indicates how to handle failures when evaluating cell formulas/expressions.
|
DataEndpoint.StatecurrentRecord, fieldNames, lastRow, startingRowfieldLineage, recordLineagelastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
ExcelReader(ExcelDocument document) |
| Modifier and Type | Method and Description |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException. |
protected Record |
addLineage(Record record) |
void |
close()
Indicates that this endpoint has finished reading or writing.
|
protected boolean |
fillRecord(Record record) |
ExcelDocument |
getDocument() |
ExcelReader.FailedExpressionStrategy |
getFailedExpressionStrategy()
Indicates how to handle failures when evaluating cell formulas/expressions (default
ExcelReader.FailedExpressionStrategy.FAIL). |
long |
getLineNumber() |
int |
getSheetIndex() |
String |
getSheetName() |
int |
getStartingColumn() |
boolean |
isAutoCloseDocument()
Indicates if the ExcelDocument should be closed when this endpoint is closed.
|
boolean |
isEvaluateExpressions()
Indicates if cell formulas/expressions should be evaluated and the result set as the field's value (default true), otherwise, the cell's formula will be
set as the field's value and no evaluation will take place.
|
boolean |
isLineageSupported() |
boolean |
isReadMetadata()
Returns whether Excel metadata (such as hyperlinks and cell styles) should be read.
|
boolean |
isUseSheetColumnCount() |
void |
open()
Makes this endpoint ready for reading or writing.
|
Record |
read()
Reads the next record from this
DataReader and increases the record-count by 1. |
ExcelReader |
setAutoCloseDocument(boolean autoCloseDocument)
Indicates if the ExcelDocument should be closed when this endpoint is closed.
|
ExcelReader |
setDescription(String description) |
ExcelReader |
setEvaluateExpressions(boolean evaluateExpressions)
Indicates if cell formulas/expressions should be evaluated and the result set as the field's value (default true), otherwise, the cell's formula will be
set as the field's value and no evaluation will take place.
|
ExcelReader |
setFailedExpressionStrategy(ExcelReader.FailedExpressionStrategy failedExpressionStrategy)
Indicates how to handle failures when evaluating cell formulas/expressions (default
ExcelReader.FailedExpressionStrategy.FAIL). |
ExcelReader |
setFieldNames(Collection<String> fieldNames) |
ExcelReader |
setFieldNames(String... fieldNames) |
ExcelReader |
setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) |
ExcelReader |
setLastRow(int lastRow) |
ExcelReader |
setReadMetadata(boolean readMetadata)
Sets whether Excel metadata (such as hyperlinks and cell styles) should be read.
|
ExcelReader |
setSaveLineage(boolean saveLineage) |
ExcelReader |
setSheetIndex(int sheetIndex) |
ExcelReader |
setSheetName(String sheetName) |
ExcelReader |
setSkipEmptyRows(boolean skipEmptyRows)
Indicates that rows with only null values should not be returned by the reader (default is false).
|
ExcelReader |
setStartingColumn(int startingColumn) |
ExcelReader |
setStartingRow(int startingRow) |
ExcelReader |
setUseSheetColumnCount(boolean useSheetColumnCount)
Set whether to use the entire worksheet (or just the current row) when
determining each record's field count.
|
getFieldNames, getLastRow, getStartingRow, isFieldNamesInFirstRow, isSkipEmptyRows, readImplavailable, getBufferSize, getNestedEndpoint, getNestedReader, getReader, getRootEndpoint, getRootReader, isExhausted, isSaveLineage, peek, pop, push, skipdecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTimepublic ExcelReader(ExcelDocument document)
public void open()
DataEndpointopen in class AbstractReaderpublic void close()
throws DataException
DataEndpointclose in class DataEndpointDataExceptionpublic ExcelDocument getDocument()
public String getSheetName()
public ExcelReader setSheetName(String sheetName)
public int getSheetIndex()
public ExcelReader setSheetIndex(int sheetIndex)
public int getStartingColumn()
public ExcelReader setStartingColumn(int startingColumn)
public long getLineNumber()
public boolean isEvaluateExpressions()
public ExcelReader setEvaluateExpressions(boolean evaluateExpressions)
public ExcelReader.FailedExpressionStrategy getFailedExpressionStrategy()
ExcelReader.FailedExpressionStrategy.FAIL).
This only applies when setEvaluateExpressions(boolean) is set to true (the default) and evaluation fails.#isEvaluateExpressions()},
#setEvaluateExpressions(boolean)}public ExcelReader setFailedExpressionStrategy(ExcelReader.FailedExpressionStrategy failedExpressionStrategy)
ExcelReader.FailedExpressionStrategy.FAIL).
This only applies when setEvaluateExpressions(boolean) is set to true (the default) and evaluation fails.#isEvaluateExpressions()},
#setEvaluateExpressions(boolean)}public boolean isUseSheetColumnCount()
public ExcelReader setUseSheetColumnCount(boolean useSheetColumnCount)
false
meaning each record may contain a different number of fields depending on
the row.public ExcelReader setAutoCloseDocument(boolean autoCloseDocument)
false.public boolean isAutoCloseDocument()
false.public ExcelReader setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
setFieldNamesInFirstRow in class AbstractReaderpublic ExcelReader setFieldNames(String... fieldNames)
setFieldNames in class AbstractReaderpublic ExcelReader setFieldNames(Collection<String> fieldNames)
setFieldNames in class AbstractReaderpublic ExcelReader setStartingRow(int startingRow)
setStartingRow in class AbstractReaderpublic ExcelReader setLastRow(int lastRow)
setLastRow in class AbstractReaderpublic ExcelReader setSkipEmptyRows(boolean skipEmptyRows)
AbstractReadersetSkipEmptyRows in class AbstractReaderpublic ExcelReader setSaveLineage(boolean saveLineage)
setSaveLineage in class DataReaderpublic ExcelReader setDescription(String description)
setDescription in class Endpointprotected boolean fillRecord(Record record) throws Throwable
fillRecord in class AbstractReaderThrowablepublic Record read() throws DataException
DataReaderDataReader and increases the record-count by 1.
This method will first read any pushed (DataReader.push(Record)) records before reading from the underlying source.
If no record is available, null will be returned. This method blocks until a record is available,
the end of the stream is reached, or an exception is thrown.
Any exception raised while reading will be converted to a DataException using DataObject.exception(Throwable).
Subclasses generally do not need to override this method, instead they should implement DataReader.readImpl().
read in class AbstractReaderDataExceptionDataReader.push(Record),
DataReader.peek(int),
DataReader.read()public boolean isLineageSupported()
isLineageSupported in class DataReaderprotected Record addLineage(Record record)
addLineage in class DataReaderpublic boolean isReadMetadata()
ExcelFieldMetadata.ExcelFieldMetadatapublic ExcelReader setReadMetadata(boolean readMetadata)
ExcelFieldMetadata.readMetadata - true to enable metadata reading, false to disable (default is false)ExcelFieldMetadatapublic DataException addExceptionProperties(DataException exception)
EndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class AbstractReaderCopyright (c) 2006-2026 North Concepts Inc. All Rights Reserved.