---
title: "CSV CRLF, title rows & skip lines in Orchestrate — Kiweely"
description: "How to output Windows CRLF (\\r\\n) line endings, add a title row above CSV headers with Create Text Template, and skip preamble lines with csv.rows(8)."
url: https://kiweely.com/guides/workday-orchestrate-csv-crlf-title-row-skip-header-lines
---

# 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 November 6
-   Applies to **Workday Orchestrate**
-   4 min read
-   Published November 6
-   By Kiweely

## 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 |
| --- | --- | --- |
| `csv.rows()` | None | Returns a `CsvRowIterator` over all rows in the CSV (excluding the header row, if one is defined in the `CsvFormat`). |
| `csv.rows(from: Number)` | `from` (0-indexed `Number`) | Returns a `CsvRowIterator` starting from the specified **0-indexed** row number to the end of the file. |
| `csv.rows(from: Number, to: Number)` | `from` (`Number`), `to` (`Number`) | Returns 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

-   [Create CSV Formats](https://developer.workday.com/documentation/GUID-856f8982-854c-4337-8bc9-700868ea4a65-enHYPHENus)
-   [Concept: Text Templates](https://developer.workday.com/documentation/GUID-e2785ee9-6d55-4f43-b375-a2e546da6503)
-   [Reference: Create Text Template](https://developer.workday.com/documentation/GUID-b77cf126-1a39-43a6-9661-c12e626969e4)
-   [Reference: Csv Member Functions](https://developer.workday.com/documentation/GUID-14486c5a-03ed-4c93-af01-143e48aca500)
-   [Add Aggregations](https://developer.workday.com/documentation/GUID-6f98991a-326a-4fc7-9085-e3d9132f1cba)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Transforming dynamic-key JSON to CSV and grouping flat CSV rows into nested JSON in Orchestrate Use json.iterator(‘$.value\[0\].SpecificContent’) with JsonKeyValueIterator and .mkString(‘,’) to build dynamic CSV headers and rows without hardcoding columns. When grouping flat CSV rows into nested JSON in Create Text Template, use !this.isLast instead of unsupported @last or #unless.](https://kiweely.com/guides/workday-orchestrate-dynamic-json-keys-to-csv-grouped-json)
-   [### Logging in Workday Orchestrate: Log, Log to File, Add Integration Message and verbose logging The Log step writes to the app logs on the Developer Site, kept 30 days. Add Integration Message writes to the integration event in the tenant. Log to File builds a named CSV log you attach with Store Document. Verbose logging is a time-limited REST switch for troubleshooting.](https://kiweely.com/guides/workday-orchestrate-logging)
-   [### Create Text Template in Orchestrate: XPath, JSONPath, #each loops and escaping Create Text Template builds a JSON, XML, CSV or text document from a message with {{ }} expressions. Read values with stringAtJsonPath or stringAtXPath, loop with {{#each … iterator(path)}}, write a literal {{ as \\{{, and escape values with toJsonStringValue or escapeXml().](https://kiweely.com/guides/workday-orchestrate-create-text-template)
-   [### Orchestrate Batch Loop: batch size, custom breaks, Group By, batch numbers and missing items Batch Loop splits a dataset into batches by Size (a fixed item count), Custom (a break at or after a matching item) or Group (items sharing a Group By value). Items go missing when Keep Leading Items is clear on a Custom strategy, the Filter removes them, or the Data Set selects the wrong node.](https://kiweely.com/guides/workday-orchestrate-batch-loop)

### More guides on Orchestrate

[All 86 guides](https://kiweely.com/guides#orchestrate)

-   [Resolving ‘\[StepException\] requirement failed: Input lists must be of the same size’ in createReferenceList](https://kiweely.com/guides/workday-orchestrate-createreferencelist-input-lists-same-size)
-   [Fixing ‘Fast forwarding to correct position’ and 45-minute timeouts in Orchestrate batchLoop](https://kiweely.com/guides/workday-orchestrate-batchloop-paginatedget-fast-forwarding-timeout)
-   [Overcoming ‘Message length should be lesser than 1MB in size’ and ‘Orchestration is too large to be saved’](https://kiweely.com/guides/workday-orchestrate-1mb-message-limit-too-large-to-save)
-   [Handling Silent GraphQL Errors in PMD and Orchestrate When HTTP Status Returns 200 OK](https://kiweely.com/guides/workday-graphql-http-200-silent-mutation-errors)
-   [Avoiding the 25-Second Synchronous Timeout When an Extend Page Calls External LLM APIs Through Orchestrate](https://kiweely.com/guides/workday-extend-async-orchestration-llm-timeout)
-   [Why Log to File Turns XML Closing Tags into <// and How to Write #if Conditions in CreateTextTemplate](https://kiweely.com/guides/workday-orchestrate-xml-double-slash-log-to-file-if-conditions)
-   [Waiting for Import\_Payroll\_Input\_Request Background Processes at Scale in Workday Orchestrate](https://kiweely.com/guides/workday-orchestrate-wait-background-process-import-payroll-input)
-   [Why Workday sub-orchestrations and BP orchestrations show Completed when an API call fails](https://kiweely.com/guides/workday-orchestrate-sub-orchestration-completed-on-api-error)

### From the blog on Orchestrate

[All posts](https://kiweely.com/blog)

-   [How Kiweely Vine designs, builds, deploys, tests and monitors a Workday Orchestration for Integration](https://kiweely.com/blog/workday-orchestration-for-integration-with-kiweely)
-   [Why Workday Studio Remains Essential in an Orchestrate World](https://kiweely.com/blog/why-workday-studio-still-matters-with-orchestrate)
-   [Debugging Workday Extend apps and orchestrations in kiweely](https://kiweely.com/blog/debugging-workday-extend-apps-orchestrations-kiweely)

## Let Workday check the work.

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

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

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