<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.commander4j.com/index.php?action=history&amp;feed=atom&amp;title=EXCEL</id>
	<title>EXCEL - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.commander4j.com/index.php?action=history&amp;feed=atom&amp;title=EXCEL"/>
	<link rel="alternate" type="text/html" href="https://wiki.commander4j.com/index.php?title=EXCEL&amp;action=history"/>
	<updated>2026-11-23T06:50:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.commander4j.com/index.php?title=EXCEL&amp;diff=2015&amp;oldid=prev</id>
		<title>Dgarratt: Updated by push_wiki.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.commander4j.com/index.php?title=EXCEL&amp;diff=2015&amp;oldid=prev"/>
		<updated>2026-11-09T20:47:22Z</updated>

		<summary type="html">&lt;p&gt;Updated by push_wiki.py&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Middleware4j]] can read and write Excel spreadsheets. Unlike the other [[Connectors|connectors]], the type name is different for each direction:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Direction !! Type in config.xml !! File formats&lt;br /&gt;
|-&lt;br /&gt;
| Input || &amp;lt;code&amp;gt;XLS&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.xls&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.xlsx&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Output || &amp;lt;code&amp;gt;EXCEL&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.xlsx&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reading a spreadsheet ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;input&amp;gt;&lt;br /&gt;
   &amp;lt;id&amp;gt;in1&amp;lt;/id&amp;gt;&lt;br /&gt;
   &amp;lt;description&amp;gt;Read Excel File&amp;lt;/description&amp;gt;&lt;br /&gt;
   &amp;lt;type&amp;gt;XLS&amp;lt;/type&amp;gt;&lt;br /&gt;
   &amp;lt;url&amp;gt;&lt;br /&gt;
      &amp;lt;path&amp;gt;./interface/input/Stock Count&amp;lt;/path&amp;gt;&lt;br /&gt;
      &amp;lt;mask/&amp;gt;&lt;br /&gt;
      &amp;lt;prefix/&amp;gt;&lt;br /&gt;
      &amp;lt;pollingInterval&amp;gt;1000&amp;lt;/pollingInterval&amp;gt;&lt;br /&gt;
   &amp;lt;/url&amp;gt;&lt;br /&gt;
   &amp;lt;xsl&amp;gt;&lt;br /&gt;
      &amp;lt;XSLTPath/&amp;gt;&lt;br /&gt;
      &amp;lt;XSLT&amp;gt;EXCEL_TO_CSV.xsl&amp;lt;/XSLT&amp;gt;&lt;br /&gt;
   &amp;lt;/xsl&amp;gt;&lt;br /&gt;
&amp;lt;/input&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no settings particular to this connector. The &amp;#039;&amp;#039;&amp;#039;first sheet&amp;#039;&amp;#039;&amp;#039; of the workbook is read and converted to rows and columns, the same layout as the [[CSV]] and [[ASCII]] input connectors produce.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;data type=&amp;quot;XLS&amp;quot; filename=&amp;quot;Stock Count.xlsx&amp;quot; rows=&amp;quot;2&amp;quot; cols=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;row id=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;col id=&amp;quot;1&amp;quot;&amp;gt;Material&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;col id=&amp;quot;2&amp;quot;&amp;gt;Quantity&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;col id=&amp;quot;3&amp;quot;&amp;gt;Counted&amp;lt;/col&amp;gt;&lt;br /&gt;
   &amp;lt;/row&amp;gt;&lt;br /&gt;
   &amp;lt;row id=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;col id=&amp;quot;1&amp;quot;&amp;gt;43170672&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;col id=&amp;quot;2&amp;quot;&amp;gt;120.0&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;col id=&amp;quot;3&amp;quot;&amp;gt;2026-08-31&amp;lt;/col&amp;gt;&lt;br /&gt;
   &amp;lt;/row&amp;gt;&lt;br /&gt;
&amp;lt;/data&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cell contains !! Value in the XML&lt;br /&gt;
|-&lt;br /&gt;
| Text || The text.&lt;br /&gt;
|-&lt;br /&gt;
| A number || The number with a decimal point, so 120 becomes &amp;lt;code&amp;gt;120.0&amp;lt;/code&amp;gt;. Use &amp;lt;code&amp;gt;format-number()&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;floor()&amp;lt;/code&amp;gt; in the stylesheet if a whole number is needed.&lt;br /&gt;
|-&lt;br /&gt;
| A date || The date as &amp;lt;code&amp;gt;yyyy-MM-dd&amp;lt;/code&amp;gt;. Any time of day is dropped.&lt;br /&gt;
|-&lt;br /&gt;
| A formula || The result of the formula.&lt;br /&gt;
|-&lt;br /&gt;
| True or false || &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| Nothing || The &amp;lt;code&amp;gt;&amp;amp;lt;col&amp;amp;gt;&amp;lt;/code&amp;gt; element is left out.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Because empty cells are left out, select columns by their &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, for example &amp;lt;code&amp;gt;col[@id=&amp;#039;3&amp;#039;]&amp;lt;/code&amp;gt;, and not by position.&lt;br /&gt;
&lt;br /&gt;
Two things to check in the spreadsheet itself:&lt;br /&gt;
&lt;br /&gt;
* The number of columns read is taken from the row with the most filled cells. Give the sheet a heading row, or at least one row, in which every column is filled in, otherwise columns on the right can be missed.&lt;br /&gt;
* A cell that is empty but has formatting applied, such as a border or a fill colour, stops the file from being read. Clear the formatting from empty cells, or put a value in them.&lt;br /&gt;
&lt;br /&gt;
A heading row in the spreadsheet arrives as row 1. To skip it, process &amp;lt;code&amp;gt;row[@id &amp;amp;gt; 1]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Writing a spreadsheet ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;output&amp;gt;&lt;br /&gt;
   &amp;lt;id&amp;gt;out1&amp;lt;/id&amp;gt;&lt;br /&gt;
   &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br /&gt;
   &amp;lt;description&amp;gt;Write Excel File&amp;lt;/description&amp;gt;&lt;br /&gt;
   &amp;lt;type&amp;gt;EXCEL&amp;lt;/type&amp;gt;&lt;br /&gt;
   &amp;lt;url&amp;gt;&lt;br /&gt;
      &amp;lt;path&amp;gt;./interface/output/Despatch&amp;lt;/path&amp;gt;&lt;br /&gt;
      &amp;lt;prefix/&amp;gt;&lt;br /&gt;
      &amp;lt;fileExtension&amp;gt;xlsx&amp;lt;/fileExtension&amp;gt;&lt;br /&gt;
      &amp;lt;use83GUID&amp;gt;false&amp;lt;/use83GUID&amp;gt;&lt;br /&gt;
      &amp;lt;retainOriginalFilename&amp;gt;false&amp;lt;/retainOriginalFilename&amp;gt;&lt;br /&gt;
   &amp;lt;/url&amp;gt;&lt;br /&gt;
&amp;lt;/output&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no settings particular to this connector either. The content of the workbook is described entirely by the XML that the stylesheet produces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;excel sheets=&amp;quot;1&amp;quot; filename=&amp;quot;Despatch_12345&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;sheet id=&amp;quot;1&amp;quot; name=&amp;quot;Sheet 1&amp;quot; cols=&amp;quot;3&amp;quot; rows=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;header&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;1&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;SSCC&amp;lt;/col&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;2&amp;quot; type=&amp;quot;double&amp;quot;&amp;gt;Quantity&amp;lt;/col&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;3&amp;quot; type=&amp;quot;isodate&amp;quot;&amp;gt;Production Date&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;/header&amp;gt;&lt;br /&gt;
      &amp;lt;row id=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;1&amp;quot;&amp;gt;000000000000000123&amp;lt;/col&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;2&amp;quot;&amp;gt;5616&amp;lt;/col&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;3&amp;quot;&amp;gt;2016-08-01T14:58:03&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;/row&amp;gt;&lt;br /&gt;
      &amp;lt;row id=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;1&amp;quot;&amp;gt;000000000000000124&amp;lt;/col&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;2&amp;quot;&amp;gt;5616&amp;lt;/col&amp;gt;&lt;br /&gt;
         &amp;lt;col id=&amp;quot;3&amp;quot;&amp;gt;2016-08-01T15:10:41&amp;lt;/col&amp;gt;&lt;br /&gt;
      &amp;lt;/row&amp;gt;&lt;br /&gt;
   &amp;lt;/sheet&amp;gt;&lt;br /&gt;
&amp;lt;/excel&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Element or attribute !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;excel / @sheets&amp;lt;/code&amp;gt; || Number of sheets in the workbook. Required.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;excel / @filename&amp;lt;/code&amp;gt; || Optional. Name for the output file, without the extension. When given it replaces the name that would otherwise be built from the input file name.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sheet / @id&amp;lt;/code&amp;gt; || Sheet number, starting at 1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sheet / @name&amp;lt;/code&amp;gt; || The name shown on the sheet tab.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sheet / @cols&amp;lt;/code&amp;gt; || Number of columns. Required.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sheet / @rows&amp;lt;/code&amp;gt; || Number of data rows, not counting the heading. Required.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;header / col&amp;lt;/code&amp;gt; || The heading for each column. The &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt; attribute sets how the values in that column are written.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;row / col&amp;lt;/code&amp;gt; || The values. Rows and columns are found by their &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; attributes, numbered from 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Column types:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! type !! Written as !! The value must be&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; || Text, left aligned. Use this for codes such as an SSCC that must keep leading zeros. || Anything.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt; || A number, right aligned. || A number in every row. An empty value causes the file to fail.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isodate&amp;lt;/code&amp;gt; || A date and time. || In the form &amp;lt;code&amp;gt;2016-08-01T14:58:03&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The heading row is written in bold on a shaded background, all cells have a border, and the column widths are adjusted to fit their content.&lt;br /&gt;
&lt;br /&gt;
The sample stylesheet &amp;lt;code&amp;gt;C4J_DESPATCH_PREADVICE_XML_to_Excel.xsl&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;samples/advanced/xslt&amp;lt;/code&amp;gt; builds a spreadsheet of pallets from a Commander4j despatch pre advice message.&lt;br /&gt;
&lt;br /&gt;
See also: [[Connectors]], [[Maps]], [[Creating a Map]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Middleware4j]]&lt;/div&gt;</summary>
		<author><name>Dgarratt</name></author>
	</entry>
</feed>