• User's guide
  • API
Search Results for

    Show / Hide Table of Contents
    • Concepts
    • Installation
    • Configuration
      • Overview
      • License
      • Datasources
      • Configuration
      • Plug-Ins
      • Codepages
      • Environment Variables
      • Include files
      • Example
    • Jobs
      • Jobs
      • Include
      • Multi-Threaded Jobs
      • Tracking Jobs
    • Tasks
      • Overview
      • Copy Check
      • Excel
      • File Compare
      • File Copy
      • File Dump
      • File Edit
      • File Format
      • Foreach
      • Generate
      • IMS/DB Data Conversion
      • JCL Submit
      • Listcat
      • Log
      • Powershell
      • Set Environment Variable
      • Sql
      • Stored Procedure Compare
      • Table Compare
      • Table Copy
      • Table Load
      • Table Scan
      • Table Unload
      • User Script
    • Layouts
      • Overview
      • XML Definition
      • COBOL Definition
      • Field data Types
    • Extensibility
      • Extending Ianus
      • Column Comparators
      • Column Converters
      • Record Comparators
      • File Editors
      • User Script
      • Record Layout Match Class
      • Column Layout Match Class
      • User Fields
      • Codepages
      • Resources
    • Usage
      • Command Line
      • Monitors
      • Programmatically
      • Unit Testing
    • Known Issues
    • Disclaimers

    Excel Import/Export

    The Excel task (excel) exchanges data between a database and excel. There are two operating modes:

    • export: data extracted by a SQL query (SELECT) is exported to an Excel datasheet;
    • import: data read from an Excel datasheet is imported to a database acording to a SQL DML statement (INSERT, UPDATE, DELETE).

    The following elements configure the task:

    Element Purpose
    sheet Defines the source or target sheet. Refer to Sheet Element for detailed description.

    The following attributes configure the task:

    Attribute Type Purpose
    db string Defines the database to import/export data to/from
    file string Full name of the Excel file to import/export data to/from
    mode string Sets the operating mode. Refer to Operating Modes for detailed description.

    Operating Modes

    The following operating modes are supported:

    Value Description
    import Data is read from Excel and stored in the table.
    export Data is obtained from a SQL query and stored in Excel

    Sheet Element

    Each import/export operation is related to a sheet element. This element defines the source/target sheet (as per attribute name) and the corresponding source/target SQL command, specified in the element value:

    • in export mode, the SQL command must be a valid query
    • in import mode, the SQL command must be a valid DML command where data from excel gets interpolated by speifying the Excel column identifier (A, B, C, etc.) as ${column_id}.

    The following attributes configure the task:

    Attribute Type Purpose
    name string Sheet name

    Example

    <job name="ZZTEST">
      <excel name="XLS01" db="QS" file="C:\tmp\export.xlsx" mode="export">
        <sheet name="XLS01">select * from xls01</sheet>
        <sheet name="TEST01">select * from test01</sheet>
      </excel>
      
      <excel name="XLS02" db="QS" file="C:\tmp\export.xlsx" mode="import">
        <sheet name="XLS01">insert into xls02 values (${A}, ${B}, ${B})</sheet>
      </excel>
    </job>
    

    Status codes

    Status Status code Description
    Ready -1 Task is initialized, but not yet started
    Running -2 Task is running
    Success 0 Task completed successfully
    Warnings 1 Task completed with warnings
    Errors 2 Task completed with errors
    Aborted 9 Task cannot be executed
    In This Article
    Back to top Copyright 2021 - Hewlett-Packard Enterprise