8.4.3 Excel Data Source Directives

If the MIME type of the file data source being read is 'application/vnd.ms-excel', the file is treated as an Excel document and the excel definitions can be used to control how the User Agent reads and writes to the Excel document.

Normally the 'excel.convert' directive is used to read the excel sheet and create a CSV or TSV data source which will be sent to the remote host. If the 'excel.convert' directive is not present then the entire excel file is sent with a content type of 'application/vnd.ms-excel'. If the excel sheet is converted to CSV or TSV the 'csv.uri' or 'tsv.uri' entry supplies the URL query string, but the 'excel.convert' entry determines the content type and charset encoding to be used.

Keyword

Comments

excel.sheet.read

Defines the excel sheet to be sent to the host. If no directive exists, then the first excel sheet is used.

excel.sheet.write

Defines the excel sheet to be used when creating an excel document. If no directive exists then "Sheet1" is used.

excel.trace

If the excel.trace directive exists and has the value of *yes, then the excel read result will be written to the trace file excel-trace.txt.

excel.filter.empty

By default, rows that have no data will be filtered out. Set this directive to the value of *no to stop this filtering.

excel.scale

Specifies the decimal scale to be used for general format numeric cells. The default value is 4.

excel.dateformat

By default the date value is formatted using the pattern yyyy-MM-dd.
Use this directive to specify your own date format pattern.
dd/MM/yyyy

excel.convert

Defines the data conversion to be applied before the data is sent to the host.
Possible options:
text/comma-separated-values
application/comma-separated-values
text/tab-separated-values
application/tab-separated-values.

An additional charset attribute controls the encoding of the data application/comma-separated-values; charset=utf-8

excel.convert.decimal

If the excel.convert.decimal directive exists and has the value of *yes, then numeric cell values will have the decimal point converted to the default locale decimal symbol.

excel.read.value.trim

*none, *both, *leading, *trailing. The default is *both.

 

 

For example, these definitions will send the content of order-data as comma separated values to the host:

 

excel.sheet.read=order-data

# excel.sheet.write=Sheet1

# excel.trace=*yes

# excel.filter.empty=*no

# excel.convert.decimal=*yes

excel.convert=text/comma-separated-values; charset=utf-8

# excel.convert=text/tab-separated-values; charset=utf-8