Skip to main content
The Excel connector converts data between Excel sheets (.xlsx) and XML files.

Key Capabilities

  • Bidirectional Excel/XML conversion in both Table and Template modes
  • Advanced template system using ArcScript for dynamic data population
  • Support for multiple worksheets with configurable row/column ranges

Overview

Excel connectors can be configured in two modes: Table and Template. These modes are described below.

Table Mode

The default mode for Excel connectors is Table. This mode only supports converting files from XLSX to XML. To convert from XML to XSLX, use Template mode. In Table mode, the connector treats input XLSX files exactly like CSV files. The resulting output XML file has the following structure, where each row (record) in the original file becomes a child of a sheet wrapper element, which is a child of the root element Items. By default, the wrapper element is named after the worksheet. To control the name of the wrapper element, see Root Element Name.

Template Mode

In Template mode, the connector uses a template file to perform conversions. This template file matches the output file format:
  • When converting from XML to Excel, the template file is an Excel file.
  • When converting from Excel to XML, the template file is an XML file.
These template files use ArcScript to dynamically populate the output files with data from the input files. For more information, see the Templates section.

Connector Configuration

This section contains all of the configurable connector properties.

Settings Tab

Configuration

Settings related to the core configuration of the connector.

Advanced Settings

Settings not included in the previous categories.

Advanced Tab

Logging

Settings that govern the creation and storage of logs.

SettingDescription
Log LevelThe verbosity of logs generated by the connector. When you request support, set this to Debug.
Log Subfolder SchemeInstructs the connector to group files in the Logs folder according to the selected interval. The Weekly option (which is the default) instructs the connector to create a new subfolder each week and store all logs for the week in that folder. Leaving this setting blank tells the connector to save all logs directly in the Logs folder. For connectors that process many transactions, using subfolders helps keep logs organized and improves performance.
Log MessagesCheck this to have the log entry for a processed file include a copy of the file itself. If you disable this, you might not be able to download a copy of the file from the Transactions tab.

Other Settings

Miscellaneous

Miscellaneous settings are for specific use cases.

SettingDescription
Other SettingsEnables you to configure hidden connector settings in a semicolon-separated list (for example, setting1=value1;setting2=value2). Normal connector use cases and functionality should not require the use of these settings.

Automation Tab

Settings related to the automatic processing of files by the connector.

Automation Settings

Performance

Settings related to the allocation of resources to the connector.

SettingDescription
Max WorkersThe maximum number of worker threads consumed from the threadpool to process files on this connector. If set, this overrides the default setting on the Performance Settings portion of the Advanced Settings page.
Max FilesThe maximum number of files sent by each thread assigned to the connector. If set, this overrides the default setting on the Performance Settings portion of the Advanced Settings page.

Alerts Tab

SLAs Tab

Templates

XML to Excel

The following snippet from an XML file contains a list of elements under the /Items/Orders path.
To convert this XML file to XSLX, you must create an Excel template. The image below shows an example Excel template that uses xmlDOMSearch and xpath to loop through the elements of the XML file: Simple Template Every Excel template must contain the following elements, which are shown in the example above:
  • Static column headers. In the example above, this is Order Detail.
  • Scripting in Excel notes. This scripting should use the xmlDOMSearch operation to loop through the input XML at a specified XPath. In the example above, this is contained in the arc:call operation.
  • Scripting in Excel cells. This scripting should use the xpath formatters to read values from the XML at a given xpath. This xpath is relative to the xpath specified in the xmlDOMSearch operation.
The details of the xmlDOMSearch operation and xpath formatters in this example are described below.

xmlDOMSearch

The xmlDOMSearch requires two parameters:

xpath formatters

The Excel notes with the xmlDOMSearch operation surround a block of cells that reference the input XML via the xpath formatter. The xpath formatter reads values from the input XML at the specified xpath.
This xpath is relative to the path provided as a parameter to the xmlDOMSearch operation.
In the above example, the first cell is populated with: [xpath("OrderNo")]. Since this xpath is relative, the cell is populated with the value from the following path in the input XML: /Items/Orders/OrderNo. If the xmlDOMSearch operation loops more than once—that is, if more than one instance of the operation’s xpath parameter is found—then the block of cells between the Excel notes is repeated. The new cells are added vertically, so in the above example the second OrderNo cell would be directly below the first Notes cell.

Excel to XML

To convert from XSLX to an XML file, you must create a custom XML template using ArcScript commands. Since XML does not support the same scripting functionality as Excel files, the structure and formatting for converting from XSLX to XML is different than from XML to Excel.
Due to the wide range of potential input and output structures, there is no universal solution for every conversion need. The example template shown below is just one of many potential solutions. You need to create a template based on your own needs.
This example template uses a combination of standard XML syntax and Arc Script to read, process, and convert data from an input Excel file. The arc:set lines below specify the location of the file and the Excel version used to create the file.
The sections below specify the conversion parameters and map the headers into standard XML formatting. The parameter [_value | toalphanum | replace(' ','')] indicates that the arc:set command should parse header names from the Excel file, convert them to alphanumeric format, eliminate blank spaces, and assign them as headers in the XML file.
The sections below process the remaining data and build the data columns according to the specified structure.

Root Element Name

In Table mode, the connector outputs one XML message for each worksheet it processes. By default, the rows of each sheet are wrapped in an element named after the sheet. For a sheet named Sheet1, the output looks like this:
If the sheet name changes from file to file, the wrapper element changes with it. Downstream XML Map connectors that reference the sheet name then fail to match unless you use wildcards in the map.
Use the Root Element Name setting to control the name of this wrapper element. The setting defaults to %SheetName%, which names the element after the worksheet being processed, as shown above. When a workbook contains multiple sheets, the connector outputs one message for each sheet. Use %Sequence% to include the processing sequence number of the sheet in the element name, so each message has a distinct wrapper element. For example, Sheet_%Sequence% produces Sheet_1 for the first sheet processed, Sheet_2 for the second, and so on.
Element names must be valid XML names. After macros are evaluated, the connector silently replaces any invalid characters in the result with an underscore (_). For example, Sales Data becomes Sales_Data.

Using a Static Name

Enter a fixed value to give every output message the same wrapper element, regardless of the sheet name. For example, with a sheet named Sheet1 and Root Element Name set to Data, the output is:
This is useful when you only process the first sheet of a workbook, or when sheet names are not predictable.

Macros

Examples

Excel Operations

In addition to the Operations provided with Arc, connectors can provide operations that extend functionality into ArcScript. These connector operations can be called just like any other ArcScript operation, except for two details:
  1. They must be called through the connector.rsc endpoint.
  2. They must include an auth token.
For example, calling a connector operation using both of these rules might look something like this:
Operations specific to the functionality of the Excel connector are listed below.

excelClose

Close an Excel connection.

Optional Parameters

  • handle: The handle for the Excel file.

Output Attributes

  • success: True if the connection is closed successfully.

excelGet

Queries the specified Excel worksheet.

Required Parameters

  • sheet: The name of the Excel worksheet.

Optional Parameters

  • version: The version of Excel you are using. The default is AUTO. You only need to choose another version if you are using a legacy Excel version.
  • file: The path to the Excel workbook.
  • handle: The handle for the Excel file.
  • map:*: This set of inputs contains a mapping of the attribute name and the name of the cell whose value is to be retrieved from the spreadsheet. For example, the attribute name map:MyValue which has a value of C1 pushes an attribute named MyValue with the value found in the cell at C1 in the sheet. You can specify a range of cell names to retrieve a range of cell values.

Output Attributes

  • *: Depends on the content of the sheet and the query specified. If column headers are present they are used to name the output attributes.

excelListSheets

Lists the worksheets in a specified Excel workbook.

Optional Parameters

  • version: The version of Excel you are using. The default is AUTO. You only need to choose another version if you are using a legacy Excel version.
  • file: The path to the Excel workbook.
  • handle: The handle for the Excel file.

Output Attributes

  • isHidden: Returns true if the sheet is hidden from view in Excel.
  • sheet: The name of the Excel worksheet. Note that the name ends with $. This is not required when specifying worksheet names to other operations.

excelOpen

Open an existing Excel workbook.

Required Parameters

  • file: The path to the Excel workbook.

Optional Parameters

  • version: The version of Excel you are using. The default is AUTO. You only need to choose another version if you are using a legacy Excel version.

Output Attributes

  • handle: The handle which is used to execute other operations.