Home > Cloud Cruiser 3 > Batch XML Reference > Universal collectors > Excel > SmartExcelCollector

SmartExcelCollector

Collects usage data from an Excel spreadsheet based on a configuration provided by SpreadSheetFeedConfig .

Class

<bean class="com.cloudcruiser.batch.collect.SmartExcelCollector">

Properties

<property name="feedConfig" ref="feedConfig
">

Sets the feed configuration for this collector. The feed configuration defines the input record set and maps fields into CC-Record content.

<property name="resource" value="resourceFile
">

The input resource. This must be either an .xls or .xlsx file.

<property name="strict" value="true">

When true, the input is required, and a missing input file will result in an exception during execution. Otherwise, the missing input will result in a warning.

Spring Batch XML Examples

Spreadsheet Reader Example

This example collects data from sample spreadsheet.xls . and outputs the data to a CC-Record file.

<bean id="sampleExcelReader" class="com.cloudcruiser.batch.collect.SmartExcelCollector">
<property name="resource" value="${env.usageDir}/samples/spreadsheet.xls"/>
<property name="feedName" value="sampleExcel"/>
<property name="feedConfig">
  <bean class="com.cloudcruiser.batch.collect.SpreadSheetFeedConfig">
    <property name="sheet" value="Sheet2" />
    <property name="outputs">
      <list>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="IDENTIFIER" />
          <property name="input" value="1" />
          <property name="label" value="Host" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="IDENTIFIER" />
          <property name="input" value="5" />
          <property name="label" value="VMName" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="RESOURCE" />
          <property name="input" value="2" />
          <property name="label" value="resource_A" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="RESOURCE" />
          <property name="input" value="3" />
          <property name="label" value="resource_B" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="USAGE_DATE" />
          <property name="input" value="6" />
        </bean>
      </list>
    </property>
  </bean>
</property>
</bean>
Header Row Example
<bean id="sampleExcelReader" class="com.cloudcruiser.batch.collect.SmartExcelCollector">
<property name="resource" value="${env.usageDir}/samples/spreadsheet.xls"/>
<property name="feedName" value="sampleExcel"/>
<property name="feedConfig">
  <bean class="com.cloudcruiser.batch.collect.SpreadSheetFeedConfig">
    <property name="sheet" value="Sheet2"/>
    <property name="header" value="true"/>
    <property name="outputs">
      <list>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="IDENTIFIER" />
          <property name="input" value="Ident_1" />
          <property name="label" value="Host" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="IDENTIFIER" />
          <property name="input" value="Ident_2" />
          <property name="label" value="VMName" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="RESOURCE" />
          <property name="input" value="resource_A" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="RESOURCE" />
          <property name="input" value="resource_B" />
        </bean>
        <bean class="com.cloudcruiser.batch.collect.OutputField">
          <property name="cctype" value="USAGE_DATE" />
          <property name="input" value="Usage" />
        </bean>
      </list>
    </property>
  </bean>
</property>
</bean>
Named Inputs Example
<bean id="sampleExcelReader" class="com.cloudcruiser.batch.collect.SmartExcelCollector">
  <property name="resource" value="${env.usageDir}/samples/spreadsheet.xls"/>
  <property name="feedName" value="sampleExcel"/>
  <property name="feedConfig">
    <bean class="com.cloudcruiser.batch.collect.SpreadSheetFeedConfig">
      <property name="sheet" value="Sheet2"/>
      <property name="header" value="true"/>
      <property name="inputs">
        <list>
          <bean class="com.cloudcruiser.batch.collect.InputField">
            <property name="pos" value="1" />
            <property name="name" value="Host" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.InputField">
            <property name="pos" value="5" />
            <property name="name" value="VMName" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.InputField">
            <property name="pos" value="2" />
            <property name="name" value="resource_A" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.InputField">
            <property name="pos" value="3" />
            <property name="name" value="resource_B" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.InputField">
            <property name="pos" value="6" />
            <property name="name" value="Usage" />
          </bean>
        </list>
      </property>
      <property name="outputs">
        <list>
          <bean class="com.cloudcruiser.batch.collect.OutputField">
            <property name="cctype" value="IDENTIFIER" />
            <property name="input" value="Host" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.OutputField">
            <property name="cctype" value="IDENTIFIER" />
            <property name="input" value="VMName" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.OutputField">
            <property name="cctype" value="RESOURCE" />
            <property name="input" value="resource_A" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.OutputField">
            <property name="cctype" value="RESOURCE" />
            <property name="input" value="resource_B" />
          </bean>
          <bean class="com.cloudcruiser.batch.collect.OutputField">
            <property name="cctype" value="USAGE_DATE" />
            <property name="input" value="Usage" />
          </bean>
        </list>
      </property>
    </bean>
  </property>
</bean>
Last modified

Tags

This page has no custom tags.

Classifications

This page has no classifications.
© Copyright 2018 Hewlett Packard Enterprise Development LP