Generates an Excel file from an XML document or generate an XML document from an Excel file.


Binding name: excel

Method: String toXml( byte[] excelBytes, SimpleDateFormat sdf )

Create an XML from spreadsheet bytes and a SimpleDateFormat.

Method: byte[] fromXml(String xml)

Create spreadsheet as byte array given XML.


The format of the input XML document should be:

<template uri="file://some/path/myspreadsheet.xls">
        <sheet name="sheet1">
                        <cell type="string" position="A1" row="0" column="0">Brian is in the kitchen</cell>
                        <cell type="date" format="yyyy-MM-dd" row="1" column="1">1989-07-14</cell>
                        <cell type="numeric" position="C3" row="2" column="2">42</cell>
                 <table position="A4" hasHeaderRow="false">
                                <column index="1" type="string" />
                                <column index="2" type="numeric" />
                                <column index="3" type="date" />
                        <data type="csv">
                 <table position="A4" hasHeaderRow="true">
                                <column index="2" type="string" >HeaderNameA</column>
                                <column index="1" type="numeric" >HeaderNameB</column>
                                <column index="4" type="date" >HeaderNameC</column>
                        <data type="xml">
         <sheet name="sheet2">


import java.text.SimpleDateFormat

def xml = resource.get('Invoice')
def bytesXls = excel.fromXml(xml)

def sdf = new SimpleDateFormat("yyyy-MM-dd")
def newXml = excel.toXml(bytesXls, sdf)