Convert a excel document in a ResultSet.
1 excel.Workbook.toResultSet
<excel.Workbook.toResultSet
start-header-row='start-header-row'
start-column='start-column'
end-column='end-column'
auto-name-columns='auto-name-columns'
sheet='sheet'
>
<value /> +
</excel.Workbook.toResultSet>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Astart-header-row | integer | 0 | Number of row by which you start. | ||
Astart-column | string | A | The letter of the first column. | ||
Aend-column | string | Q | The letter of the last column. | ||
Aauto-name-columns | boolean | false | In case of TRUE to the first column, the system will assign as name c1, the second one c2 and so on, if it is FALSE the name of the columns coincides with the values of the first row. | ||
Asheet | string | Identifier of the excel sheet, if it is not informed by default the first sheet is taken. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Evalue | Workbook |
Returns | |
---|---|
Type | Description |
ResultSet | Return a ResultSet with the values of the cells. |
Example
Return a ResultSet with the values of the cell from the row 14 starting by the column C and ending in the column I.
Copy
<xsql-script name='execelToResultset'> <body> <println> <excel.Workbook.toResultSet start-header-row='14' start-column='C' end-column='I'> <excel.Workbook type='xlsx'> <file type='disktool' name='test.xlsx' /> </excel.Workbook> </excel.Workbook.toResultSet> </println> </body> </xsql-script>
Shows the following result.
Copy
+------+---------+------------+----------+-----------------+------------+----------------+ |Code |Name |Start date |Final date|Total_Purchasses |Total_Sales |Total_Returns | |char |char |date |date |long |long |long | +------+---------+------------+----------+-----------------+------------+----------------+ |X1 |Producto1|01-01-2013 |31-01-2013| 31| 31| 1| |X2 |Producto2|01-01-2013 |31-01-2013| 31| 200| 2| |X3 |Producto3|01-02-2013 |28-02-2013| 28| 280| 1| |X4 |Producto4|01-12-2012 |31-12-2012| 56| 22| 1| |X5 |Producto5|01-11-2012 |30-11-2012| 45| 21| 5| +------+---------+------------+----------+-----------------+------------+----------------+
Example
This example is the same for the exception that the columns are self-named.
Copy
<xsql-script name='execelToResultset'> <body> <println> <excel.Workbook.toResultSet start-header-row='14' start-column='C' end-column='I' auto-name-columns='true'> <excel.Workbook type='xlsx'> <file type='disktool' name='test.xlsx' /> </excel.Workbook> </excel.Workbook.toResultSet> </println> </body> </xsql-script>
Shows the following result.
Copy
+----+---------+----------+----------+----+----+----+ |c1 |c2 |c3 |c4 |c5 |c6 |c7 | |char|char |date |date |long|long|long| +----+---------+----------+----------+----+----+----+ |X1 |Product1 |01-01-2013|31-01-2013| 31| 31| 1| |X2 |Product2 |01-01-2013|31-01-2013| 31| 200| 2| |X3 |Product3 |01-02-2013|28-02-2013| 28| 280| 1| |X4 |Product4 |01-12-2012|31-12-2012| 56| 22| 1| |X5 |Product5 |01-11-2012|30-11-2012| 45| 21| 5| +----+---------+----------+----------+----+----+----+