Skip to main content
The CSV connector converts comma-separated values (CSV) files into XML and generates CSV files from XML.

Key Capabilities

  • Bidirectional CSV/XML conversion with configurable delimiters and encoding
  • Header detection and custom column mapping capabilities
  • Support for various character encodings and special character handling

Overview

Connector Configuration

This section contains all of the configurable connector properties.

Settings Tab

Configuration

Settings related to the connector Id and description.

Connector Settings

Settings related to the core operation of the connector.

Other Settings

Settings not included in the previous categories.

Sample Files Tab

Advanced Tab

Message

Logging

Miscellaneous

Automation Tab

Automation Settings

Performance

Alerts Tab

SLAs Tab

Converting CSV to XML

When a file is transformed into XML, the resulting XML has the following structure:
Each row (record) in the original file becomes a child of the root element Items. The name of all record elements is determined by the Record Name option set in Connector Settings. Each record element then has child elements corresponding to the values in each row of the input file. Some files include a line of header information that provides context to the values in the file. When the First line is header information setting is enabled, this header line is parsed, and the parsed headers are used as the element names for the value elements (the children of the record elements). Otherwise, the value elements are given generic names such as field_0, field_1, and so on.

Converting XML to CSV

To convert XML to a file, the input XML must have a ‘flat’ structure. This means that, disregarding the Items root element, the depth of the XML structure is two. For example:
The XML is interpreted as follows:
  • Children of the root element are treated as records (rows) in the resulting file
  • Children of each record element are treated as the values in each row
If the First line is header information option is enabled, a header row is inserted into the resulting file with the names of each value element to provide context to the values. In the example above, this header row would consist of title, year, and runtime.

CSV Transformation: Using the XML Map Connector

CSV 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 CSV connector are listed below.

csvListRecords

Loops over every record in a specified CSV file or string. See Functions for more details.

Required Parameters

  • file: The path to the CSV file.

Optional Parameters

  • data: If the CSV data exists as a string rather than stored in a CSV file, use this parameter instead of file.
  • columns: The comma-separated list of columns to include in the output (if unspecified, all columns are included).
  • requireheader: By default, the first row of data is interpreted as column headers; pass false to this parameter to use generic column names (for example, c1, c2, c3).

Output

Any script in a csvListRecords operation executes multiple times: once for each record/row in the input CSV file/data. Within the operation, individual CSV values are accessible using the csv formatter. This formatter takes a column name as a parameter, and outputs the value in that column for the current record. For example, imagine the CSV input data contains a set of items purchased in an order, and the name of the item is held in the ItemName column. The following script generates XML containing each ItemName value in an Item element:

Macros

Examples