The Microsoft Excel Translator, known by the type name excel, exposes querying functionality to Excel documents using File Data Sources. Microsoft Excel is a popular spreadsheet software that is used by all the organizations across the globe for simple reporting purposes. This translator provides an easy way read a Excel spreadsheet and provide contents of the spreadsheet in the tabular form that can be integrated with other sources in Teiid.
"Does it only work on Windows?"
No, it works on all platforms, including Windows and Linux. This translator uses Apache POI libraries to access the Excel documents which are platform independent.
Usage
The below table describes how Excel translator interprets the data in Excel document into relational terms.
Excel Term
|
Relational Term
|
Workbook
|
schema
|
Sheet
|
Table
|
Row
|
Row of data
|
Cell
|
Column Definition or Data of a column
|
Excel translator supports "source metadata" feature, where given Excel workbook, it can introspect and build the schema based on the Sheets defined inside it. There are options available for you guide, to be able to detect header columns and data columns in a work sheet to define the correct metadata of a table.
Dynamic VDB
The below shows example of Dynamic VDB, that shows a exposing a Excel Document.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="excelvdb" version="1">
<model name="excel">
<property name="importer.headerRowNumber" value="1"/>
<property name="importer.ExcelFileName" value="names.xls"/>
<source name="connector" translator-name="excel" connection-jndi-name="java:/fileDS"/>
</model>
</vdb>
"connection-jndi-name" in above represents connection to Excel document. The Excel translator does NOT provide a connection to the Excel Document. For that purpose, Teiid uses File JCA adapter that provides a connection to Excel. To define such connector, see File Data Sources or see an example in "<jboss-as>/docs/teiid/datasources/file". Once you configure both of the above, you can deploy them to Teiid Server and access the Excel Document using JDBC/ODBC/OData protocol.
Designer VDB
If you are using Designer Tooling, to create Excel based VDB
-
Create/use a Teiid Designer Model project
-
Use "Teiid Connection >> Source Model" importer, create File Data Source using data source creation wizard and use excel as translator in the importer. Based on the Excel document relevant relational tables will be created.
-
Create a VDB and deploy into Teiid Server and and access the Excel Document using JDBC/ODBC/OData protocol.
"Headers in Document?"
If you have headers in the Excel document, you can guide the import process to select the cell headers as the column names in the table creation process. See "Import Properties" section below on defining the "import" properties.
Import Properties
Import properties guide the schema generation part during the deployment of the VDB. This can be used in Dynamic VDBs or while using "Teiid Connection >> Source Model" in Teiid Designer.
Property Name
|
Description
|
Default
|
importer.excelFileName
|
Defines the name of the Excel Document
|
required
|
importer.headerRowNumber
|
Defines the cell header information to be used as column names
|
optional, default is first data row of sheet
|
importer.dataRowNumber
|
Defines the row number where the data rows start
|
optional, default is first data row of sheet
|
It is highly recommended that you define all the above importer properties, such that information inside the Excel Document is correctly interpreted.
Translator Extension Properties
Currently there are no Translator Extension properties defined for this translator.
JCA Resource Adapter
The Teiid specific Excel Resource Adapter does not exist, user should use File JCA adapter with this translator. See File Data Sources for opening a File based connection.
Native Queries
This feature is not applicable for Excel translator.
Direct Query Procedure
This feature is not applicable for Excel translator.