All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, DataReaderFactory, JavaCodeGenerator, Serializable

public class ExcelPipelineInput extends FileSourcePipelineInput
Reads a pipeline's source data from a sheet of an Excel FileSource using an ExcelReader.
See Also:
  • Constructor Details

    • ExcelPipelineInput

      public ExcelPipelineInput()
  • Method Details

    • getName

      public String getName()
      Description copied from class: PipelineInput
      Returns a display name for this input, such as the source's name followed by its format.
      Overrides:
      getName in class FileSourcePipelineInput
    • isLineageSupported

      public boolean isLineageSupported()
      Description copied from class: PipelineInput
      Indicates if this input can save data lineage on the records it reads (false unless a subclass overrides it).
      Overrides:
      isLineageSupported in class PipelineInput
    • setSaveLineage

      public ExcelPipelineInput setSaveLineage(boolean saveLineage)
      Description copied from class: PipelineInput
      Indicates if data lineage (where each record and field came from) is saved on the records read (defaults to false); enabling it throws an exception if lineage is not supported.
      Overrides:
      setSaveLineage in class PipelineInput
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class PipelineInput
    • fromRecord

      public ExcelPipelineInput fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class PipelineInput
      Parameters:
      source -
      Returns:
      this instance.
    • getFileSource

      public FileSource getFileSource()
      Specified by:
      getFileSource in class FileSourcePipelineInput
    • setFileSource

      public ExcelPipelineInput setFileSource(FileSource fileSource)
      Specified by:
      setFileSource in class FileSourcePipelineInput
    • getProviderType

      public ExcelDocument.ProviderType getProviderType()
      Returns the provider used to read the workbook (defaults to ExcelDocument.ProviderType.POI_XSSF).
    • setProviderType

      public ExcelPipelineInput setProviderType(ExcelDocument.ProviderType providerType)
      Sets the provider used to read the workbook (defaults to ExcelDocument.ProviderType.POI_XSSF).
    • getSheetName

      public String getSheetName()
      Returns the name of the sheet to read; when blank, the sheet at getSheetIndex() is read (defaults to null).
    • setSheetName

      public ExcelPipelineInput setSheetName(String sheetName)
      Sets the name of the sheet to read; when blank, the sheet at getSheetIndex() is read (defaults to null).
    • getSheetIndex

      public int getSheetIndex()
      Returns the 0-based index of the sheet to read when no sheet name is set (defaults to 0).
    • setSheetIndex

      public ExcelPipelineInput setSheetIndex(int sheetIndex)
      Sets the 0-based index of the sheet to read when no sheet name is set (defaults to 0).
    • getStartingRow

      public int getStartingRow()
      Returns the 0-based index of the first row to read (defaults to 0).
    • setStartingRow

      public ExcelPipelineInput setStartingRow(int startingRow)
      Sets the 0-based index of the first row to read (defaults to 0).
    • getLastRow

      public int getLastRow()
      Returns the 0-based index of the last row to read or a negative value to read to the end of the sheet (defaults to -1).
    • setLastRow

      public ExcelPipelineInput setLastRow(int lastRow)
      Sets the 0-based index of the last row to read or a negative value to read to the end of the sheet (defaults to -1).
    • getStartingColumn

      public int getStartingColumn()
      Returns the 0-based index of the first column to read (defaults to 0).
    • setStartingColumn

      public ExcelPipelineInput setStartingColumn(int startingColumn)
      Sets the 0-based index of the first column to read (defaults to 0).
    • isSkipEmptyRows

      public boolean isSkipEmptyRows()
      Indicates if rows whose values are all null or empty are skipped (defaults to false).
    • setSkipEmptyRows

      public ExcelPipelineInput setSkipEmptyRows(boolean skipEmptyRows)
      Indicates if rows whose values are all null or empty are skipped (defaults to false).
    • isFieldNamesInFirstRow

      public boolean isFieldNamesInFirstRow()
      Indicates if the first row read holds the field names (defaults to false).
    • setFieldNamesInFirstRow

      public ExcelPipelineInput setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
      Indicates if the first row read holds the field names (defaults to false).
    • isEvaluateExpressions

      public boolean isEvaluateExpressions()
      Indicates if formulas are evaluated and their results read instead of the formula text (defaults to true).
    • setEvaluateExpressions

      public ExcelPipelineInput setEvaluateExpressions(boolean evaluateExpressions)
      Indicates if formulas are evaluated and their results read instead of the formula text (defaults to true).
    • getFailedExpressionStrategy

      public ExcelReader.FailedExpressionStrategy getFailedExpressionStrategy()
      Returns how a failed formula evaluation is handled (defaults to ExcelReader.FailedExpressionStrategy.FAIL).
    • setFailedExpressionStrategy

      public ExcelPipelineInput setFailedExpressionStrategy(ExcelReader.FailedExpressionStrategy failedExpressionStrategy)
      Sets how a failed formula evaluation is handled (defaults to ExcelReader.FailedExpressionStrategy.FAIL).
    • isUseSheetColumnCount

      public boolean isUseSheetColumnCount()
      Indicates if every record gets a field for each column in the sheet, not just its own row's cells (defaults to false).
    • setUseSheetColumnCount

      public ExcelPipelineInput setUseSheetColumnCount(boolean useSheetColumnCount)
      Indicates if every record gets a field for each column in the sheet, not just its own row's cells (defaults to false).
    • isAutoCloseDocument

      public boolean isAutoCloseDocument()
      Indicates if the Excel document is closed when the reader is closed (defaults to false).
    • setAutoCloseDocument

      public ExcelPipelineInput setAutoCloseDocument(boolean autoCloseDocument)
      Indicates if the Excel document is closed when the reader is closed (defaults to false).
    • getFieldNames

      public List<String> getFieldNames()
      Returns the names given to the fields in column order, overriding any read from the first row (null or empty if unset).
    • setFieldNames

      public ExcelPipelineInput setFieldNames(String... fieldNames)
      Sets the names given to the fields in column order, overriding any read from the first row; must not be empty.
    • setFieldNames

      public ExcelPipelineInput setFieldNames(Collection<String> fieldNames)
      Sets the names given to the fields in column order, overriding any read from the first row; must not be empty.
    • createDataReader

      public DataReader createDataReader()
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
      Overrides:
      toXmlElement in class PipelineInput
    • fromXmlElement

      public ExcelPipelineInput fromXmlElement(Element element)
      Specified by:
      fromXmlElement in interface XmlSerializable
      Overrides:
      fromXmlElement in class PipelineInput