---
title: Flat File CSV Search Field Expression Plugin – Extract Values from Delimited Messages
description: "Extract values from CSV and other delimited message bodies with the Nodinite Flat File CSV Search Field Expression plugin: delimiter, zero-based fields, header rows, quote, and comment settings with a tested example."
---

# :fa-magnifying-glass: Flat File CSV Search Field Expression Plugin

The **Flat file CSV** plugin extracts [Search Field][Search Fields] values from delimited text in the Message Body of a [Log Event][], such as CSV exports and semicolon-separated flat files. You pick the columns by zero-based index, or by column name when the file has header rows.

* ✅ Any Delimiter, such as `;`, `,`, or a longer one such as `||`  
* ✅ Fields by zero-based index, list, range, or header name  
* ✅ Skips header rows and commented-out lines  

![Flat file CSV returns Northwind Traders from the CustomerName column of an order confirmation, animated walkthrough (7.12)][3]  
*Animated walkthrough: **Number of header rows** `2`, **Delimiter** `,` and **Fields** `CustomerName` on a logged Order-to-Cash order confirmation return `Northwind Traders`.*  

## :fa-scale-balanced: When to use it

| Your data | Use |
| --- | --- |
| CSV or other delimited text in the Message Body, value in a known column | **Flat file CSV** (this plugin) |
| Fixed-width records, value at a known character position | [Flat file Fixed width][Flat File Fixed Width] |
| Delimited text in a context property, or a column you need to transform or combine further | [Formula][] with the [csv][Formula - CSV] function |
| Text without a consistent column structure | [RegEx][] |

For all plugins side by side, see [Choose a plugin][].

## :fa-code: Expression syntax

Select **Flat file CSV** in the **Type** list, then fill in these fields:

![Type list open with the Expression Types, Flat file CSV first (7.12)][1]  
*The Flat file CSV plugin in the Type list.*  

| Field | What goes in it | Example |
| --- | --- | --- |
| **Number of header rows** | How many rows at the top of the message are headers. When set, you can use the header names in **Fields**. With several header rows, the last one names the columns. | `0`, `1` |
| **Delimiter** | The text that separates the fields. Usually one character, but longer delimiters such as `\|\|` work. For tab, paste a real tab character; the text `\t` doesn't work. Never leave it empty: the test then fails with *Index was outside the bounds of the array.* | `;`, `,`, `\|\|` |
| **Fields** | The columns to extract, zero-based: `0` is the first column, `1` the second. Use a list (`0,2`), a range (`1,3-4`), header names (`OrderId,Customer`, requires **Number of header rows** of at least `1`), or a mix. Don't put spaces before header names: `Name, City` looks for a header named "City" with a leading space. A header name may contain a hyphen, such as `Order-Id`: an entry is a range only when both sides are numbers. | `1` |
| **Ignore missing fields** | Checked: rows that lack a listed column are skipped. Unchecked: the whole expression fails on the first row that lacks the column, and returns no values at all. | Checked |
| **Quote** | The single character that wraps (escapes) a field, so the field can contain the Delimiter. Defaults to `"`. | `"` |
| **Comment** | The single character that marks a line as commented out; the plugin skips those lines. It applies only when set. | `#` |

* There is no row selection: every listed column is read from **every** row after the header rows.
* A header name with a hyphen works in **Fields**, such as `Order-Id` in a body that starts `Order-Id;Customer`:

  ![Flat file CSV with Number of header rows 1, Delimiter semicolon, and Fields Order-Id, tested on a body with the header Order-Id;Customer (7.12)][5]  
  *The header name `Order-Id` in **Fields**.*  
* Values are returned exactly as they are in the file, spaces included: in `a; b ;c`, column `1` is "b" with a space on each side. Unlike [Flat file Fixed width][Flat File Fixed Width], the CSV plugin doesn't trim values. A value that is only white space is dropped.
* A file with several sections, each with its own column layout (a header section, a details section, a footer), is read as one table. A column index that exists in the later sections too picks up their values as well. In the walkthrough above, `Fields = OrderId` would also return `QuantityOrdered`, `5`, `TrackingEnabled`, and `true`; only `CustomerName`, a column that exists in the header section alone, gives a clean value. For such files, use [Formula][] with the [csv][Formula - CSV] function, or [RegEx with capturing groups][].

The plugin returns each unique value once (see [How expressions run][]). Configure the plugin in [Add or manage Search Field][] and check the result with [Test Your Expression][]. When no field matches, the test reports *Processed with warning: The Expression yields no result* instead of values. When the plugin fails, for example on an empty **Delimiter**, the error message is shown below it:

![Test Expression result: Processed with warning, The Expression yields no result (7.12)][0]  
*The test result when the expression finds no value.*  

## :fa-list-ol: Examples

### Example 1: Extract order numbers from a semicolon-separated file

#### Input

```csv
ORD;101;ACME;456;Company Name ACME ;Dieselgate valley 1;123 45;Flameburg;
ORD;102;Northwind;789;Company Name Northwind;Radiator Spring 420;543 21;Apocalypsenburg;
```

#### Expression

```text
Number of header rows = 0
Delimiter = ;
Fields = 1
Ignore missing fields = checked
Quote = "
Comment = #
```

#### Result

```text
101
102
```

Field `1` is the second column, because Fields are zero-based.

![Test Expression tab with Type Flat file CSV, Number of header rows 0, Delimiter ; and Fields 1; the Result lists 101 and 102 from the two ORD lines in the Message Body (7.12)][2]  
*Field 1 returns the order numbers 101 and 102.*  

### Example 2: Extract a column by its header name

#### Input

```csv
OrderId;Customer;Amount
5001;ACME;1200.50
5002;Northwind;89.90
5003;ACME;310.00
```

#### Expression

```text
Number of header rows = 1
Delimiter = ;
Fields = Customer
```

#### Result

```text
ACME
Northwind
```

The header row names the columns, so `Customer` selects the second column. `ACME` appears twice in the data but is returned once.

![Test Expression tab with Type Flat file CSV, Number of header rows 1 and Fields Customer; the Result lists ACME and Northwind from the OrderId;Customer;Amount body (7.12)][4]  
*With one header row, the Fields value `Customer` selects the column by name.*  

## :fa-hand-point-right: Next Steps

* :fa-pen-to-square: [Add or manage Search Field][]  
* :fa-flask: [Test Your Expression][]  
* :fa-eye: [Add or manage Log View][]  

## :fa-link-horizontal: Related Topics

* :fa-magnifying-glass-plus: [Search Field Expressions][]  
* :fa-ruler-horizontal: [Flat file Fixed width][Flat File Fixed Width]  
* :fa-function: [Formula - CSV][]  
* :fa-spell-check: [RegEx][]  
* :fa-magnifying-glass: [Search Fields][]  
* :fa-message: [Message Types][]  
* :fa-table-list: [Log Views][]  

[0]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/NoResult.png
[1]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Flat%20File%20CSV/Select.png
[2]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Flat%20File%20CSV/Example1.png
[3]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Expression_FlatFileCsv.gif
[4]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Flat%20File%20CSV/Example2.png
[5]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Flat%20File%20CSV/HeaderNameWithHyphen.png

[Add or manage Log View]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/Add%20or%20Manage%20Log%20View.md
[Add or manage Search Field]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md
[Choose a plugin]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md#fa-signs-post-choose-a-plugin
[Flat File Fixed Width]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Flat%20File%20Fixed%20Width.md
[Formula]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Overview.md
[Formula - CSV]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Extract/csv.md
[How expressions run]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md#fa-gears-how-expressions-run
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Log Views]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/What%20is%20a%20Log%20View.md
[Message Types]:{ndr}/Repository%20Model/Message%20Types/Overview.md
[RegEx]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/RegEx.md
[RegEx with capturing groups]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/RegEx%20with%20capturing%20groups.md
[Search Field Expressions]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md
[Search Fields]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/What%20is%20a%20Search%20Field.md
[Test Your Expression]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md#test-your-expression