Skip to content
KiweelyKiweelyKiweely

Custom CSV formatting in Workday Orchestrate: Windows CRLF line endings, title rows, and skipping preamble lines

Orchestrate’s CSV Fold aggregation outputs UNIX LF (\n) line endings and fixed column headers. Use Create Text Template with {{chars.cr}}{{chars.newline}} and line-continuation backslashes (\) for Windows CRLF and pre-header title rows, and use .asCSV().rows(from) to skip leading preamble lines.

  • Checked against Workday on
  • Applies to Workday Orchestrate
  • 4 min read
  • Published
  • By Kiweely
On this page

Why CSV Formats and CSV Fold cannot produce CRLF or pre-header title blocks alone

When you configure a custom CSV schema under Orchestration Settings -> CSV Formats (Create CSV Formats) and use it in a loop’s CSV Fold aggregation (Add Aggregations), Orchestration Builder lets you configure:

  • Header Row (checkbox to include the column names as the first line)
  • Separator Character (defaults to ,)
  • Escape Character (defaults to \)
  • Quote Character (defaults to ")
  • Columns (column names and required flags)

However, third-party payroll, banking, and benefits vendors frequently enforce three file formatting rules that CSV Formats and CSV Fold do not expose directly:

  1. Windows CR/LF (\r\n) line endings instead of the default UNIX LF (\n) line endings produced by CSV Fold and Create Text Template.
  2. A static title or banner row above the CSV header row (for example, PARTICIPANTS on line 1, followed by Name,First Name,Last Name,Employee ID on line 2).
  3. Skipping an arbitrary number of metadata/preamble lines (for example, the first 8 lines of an inbound bank rate CSV) before iterating over the data rows.

Here is how to implement all three patterns cleanly in Workday Orchestrate.

Pattern 1: Outputting Windows CR/LF (\r\n) line endings and a pre-header title row

When you type a normal multi-line template inside Create Text Template, Orchestration Builder emits a UNIX newline (\n) at the end of every line. If you simply place {{chars.cr}} at the end of each line, or let {{#each ...}} sit on its own line, your output file will contain extra blank lines or mixed \n and \r\n terminators.

The key is to combine Orchestrate’s built-in character references ({{chars.cr}}{{chars.newline}}) with the line continuation backslash (\) documented in Concept: Text Templates:

  • Ending any template line with a single backslash (\) tells Create Text Template to ignore both the backslash and the subsequent UNIX line break in the template editor.
  • Ending a line with {{chars.cr}}{{chars.newline}}\ therefore writes an exact Windows \r\n sequence and suppresses the template editor’s own \n.

Step-by-step configuration

  1. On your upstream Loop‘s CSV Fold aggregation (for example, LoopBatchToCSV producing CSVOutput), leave Header Row unchecked in the CSV Format if you plan to write the title line and column headers inside Create Text Template.
  2. Add a Create Text Template step with Content Type set to text/csv.
  3. Enter the template below, ensuring there are no trailing spaces after the \ at the end of each line:
handlebars
PARTICIPANTS{{chars.cr}}{{chars.newline}}\
Name,First Name,Last Name,Preferred Name,Job Profile,Effective Date,Employee ID{{chars.cr}}{{chars.newline}}\
{{#each data.LoopBatchToCSV.CSVOutput.iterator}}\
{{this}}{{chars.cr}}{{chars.newline}}\
{{/each}}

How this template works

  • **Line 1 (PARTICIPANTS{{chars.cr}}{{chars.newline}}\):** Writes the vendor’s required pre-header title line terminated by \r\n, and suppresses the editor’s newline.
  • **Line 2 (Name,First Name,...{{chars.cr}}{{chars.newline}}\):** Writes the CSV column header row terminated by \r\n.
  • **Line 3 ({{#each data.LoopBatchToCSV.CSVOutput.iterator}}\):** Iterates over each aggregated CSV row (CsvRow converted to string via {{this}}). The trailing \ prevents the {{#each ...}} tag itself from injecting a blank line before the first data row.
  • **Line 4 ({{this}}{{chars.cr}}{{chars.newline}}\):** Outputs the formatted CSV row followed by \r\n. Because **Create Text Template**’s runtime is fully streaming, iterating through CSVOutput.iterator streams large CSV files to your downstream Store Document step without holding the concatenated string in memory.

If you only need to prepend a static title row above a CSV Fold output that already includes its own header row and uses standard UNIX \n line endings, you can pass the entire CSV output without looping:

handlebars
PARTICIPANTS
{{data.LoopBatchToCSV.CSVOutput}}

Pattern 2: Skipping the first N preamble lines when reading an inbound CSV

Inbound bank and treasury CSV files often begin with several non-tabular metadata rows before the actual data rows start. For example, consider a foreign-exchange rate file where data rows begin on line 9 (after 8 preamble and header lines):

csv
Fixed Rates Customer: ,XXX,
Platform: ,Cashpro Payments,
Rate Convention: ,Market Convention,
Home Currency: ,USD,
Maximum Transaction Amount: ,1 USD,
,
Currency,Trade Amount <= 1 USD,Rate Direction
,Buy,
CAD,1.3585,Indirect
EUR,2.1789,Direct
GBP,3.37,Direct

If you pass .asCSV().iterator() or .asCSV().rows() into a Loop, Orchestrate starts reading at line 1 (row 0), which fails column parsing or pollutes your loop with metadata lines.

Using .rows(from: Number) on a Csv instance

Workday’s Reference: Csv Member Functions provides three overloads of the .rows member function on Csv objects:

Member Function Arguments Behavior
Member Functioncsv.rows() ArgumentsNone BehaviorReturns a CsvRowIterator over all rows in the CSV (excluding the header row, if one is defined in the CsvFormat).
Member Functioncsv.rows(from: Number) Argumentsfrom (0-indexed Number) BehaviorReturns a CsvRowIterator starting from the specified 0-indexed row number to the end of the file.
Member Functioncsv.rows(from: Number, to: Number) Argumentsfrom (Number), to (Number) BehaviorReturns a CsvRowIterator starting at from and ending at to (both 0-indexed).

Because .rows(from) is 0-indexed, rows 0 through 7 represent the first 8 lines of the file, and index 8 is the 9th line (CAD,1.3585,Indirect).

In your Loop step’s Data Set expression field, treat the inbound document as CSV (with a CSV Format where Header Row is unchecked) and call .rows(8):

javascript
data.RetrieveRateFile.document.asCSV("UnheadedThreeColumnFormat").rows(8)

Inside the loop, read each column by 0-based index (data.LoopRates.item.columnValueAtIndex(0) for "CAD", data.LoopRates.item.columnValueAtIndex(1) for "1.3585") or by column name (data.LoopRates.item.columnValue("Currency")) defined on UnheadedThreeColumnFormat.

How to verify your CSV output and row skipping in the tenant

  1. For outbound CR/LF files, run the orchestration, download the stored CSV file from the Integration Event‘s Documents tab, and inspect it with file <filename>.csv (which should report with CRLF line terminators) or od -c <filename>.csv to verify every line ends with \r \n and no extra blank lines appear after PARTICIPANTS or the header row.
  2. For inbound preamble skipping, select the Loop step in Orchestration Builder, click Debug Step against a test run with the 8-line preamble CSV attached, and confirm in Debug Outputs that iteration 1 starts directly on CAD,1.3585,Indirect (line 9).

Sources checked

Related guides

All guides

Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.

We’ll email you once to confirm. Unsubscribe in one click from any issue.