With the Spreadsheet adapter you can access Excel documents via their workbook-sheet-row-cell structure and create CSV files out of Excel documents.
The Spreadsheet adapter uses the HSSF and XSSF component of Apache POI.
Example File (Builder project Spreadsheet):
Data Model of the Spreadsheet Adapter
The adapter provides a data model (Workbook, Sheet, Row, Cell) representing the Excel document. This data model is created by calling one of the various createWorkbook operations.
Creating a Workbook
createWorkbook( filename : String ) : Workbook
returns a Workbook object (empty cells/rows are omitted)
|
Parameter |
Direction |
Description |
|---|---|---|
|
filename |
in |
The filename of the Excel document. |
|
workbook |
return |
The Workbook object representing the Excel document. |
createWorkbook( filename : String, omitEmptyCells : Boolean ) : Workbook
returns a Workbook object
|
Parameter |
Direction |
Description |
|---|---|---|
|
filename |
in |
The filename of the Excel document. |
|
omitEmptyCells |
in |
If true, empty cells/row will be omitted from the returned Workbook object. |
|
workbook |
return |
The Workbook object representing the Excel document. |
createWorkbook( input : Blob ) : Workbook
returns a Workbook object (empty cells/rows are omitted)
|
Parameter |
Direction |
Description |
|---|---|---|
|
input |
in |
The blob holding the Excel document. |
|
workbook |
return |
The Workbook object representing the Excel document. |
createWorkbook( input : Blob, omitEmptyCells : Boolean ) : Workbook
returns a Workbook object
|
Parameter |
Direction |
Description |
|---|---|---|
|
input |
in |
The blob holding the Excel document. |
|
omitEmptyCells |
in |
If true, empty cells/row will be omitted from the returned Workbook object. |
|
workbook |
return |
The Workbook object representing the Excel document. |
Generating CSV out of Excel Documents
The adapter provides various toCSV operations to generate CSV documents out of Excel documents.
toCSV( filename : String, sheetNumber : Integer, separator : String, encoding : String ) : Blob
|
Parameter |
Direction |
Description |
|---|---|---|
|
filename |
in |
The filename of the Excel document. |
|
sheetNumber |
in |
The number of the worksheet to be converted. |
|
separator |
in |
The separator character to be used in the CSV document(s). |
|
encoding |
in |
The encoding (e.g. "utf-8") of the CSV data. |
|
return |
return |
A blob holding the CSV data. |
There are variants of this operation where sheetNumber (default: 0), separator (default: ,) or encoding don't have to be set.
toCSV( workbook : Workbook, sheetNumber : Integer, separator : String, encoding : String ) : Blob
|
Parameter |
Direction |
Description |
|---|---|---|
|
workbook |
in |
The Excel workbook to be converted. |
|
sheetNumber |
in |
The number of the worksheet to be converted. |
|
separator |
in |
The separator character to be used in the CSV document(s). |
|
encoding |
in |
The encoding (e.g. "utf-8") of the CSV data. |
|
return |
return |
A blob holding the CSV data. |
There are variants of this operation where sheetNumber (default: 0), separator (default: ,) or encoding don't have to be set.
toCSV( sheet : Sheet, separator : String, encoding : String) : Blob
|
Parameter |
Direction |
Description |
|---|---|---|
|
sheet |
in |
The Excel worksheet to be converted. |
|
separator |
in |
The separator character to be used in the CSV document(s). |
|
encoding |
in |
The encoding (e.g. "utf-8") of the CSV data. |
|
return |
return |
A blob holding the CSV data. |
There are variants of this operation where separator (default: ,) or encoding does not have to be set.
Extract the javadoc folder from spreadsheetadapter.jar to get additional information on the Java methods wrapped by this adapter.