---
title: "__CSVRead"
description: "JMeter __CSVRead function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values."
url: https://docs.jmeter.ai/functions/csvread/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# __CSVRead

*Also documented in context in the [full Functions and Variables reference](/user-manual/functions/#__CSVRead).*

**TL;DR:** `__CSVRead` reads a value from a CSV file by column and row, function-style — an older alternative to the [CSV Data Set Config](/components/csv-data-set-config/) element, still useful for one-off lookups (e.g. a config value from a small reference file) rather than full per-thread parameterization.

The CSVRead function returns a string from a CSV file (c.f. StringFromFile)

NOTE: JMeter supports multiple file names.

**In most cases, the newer
[CSV Data Set Config element](/components/csv-data-set-config/)
is easier to use.**

When a filename is first encountered, the file is opened and read into an internal
array. If a blank line is detected, this is treated as end of file - this allows
trailing comments to be used.

All subsequent references to the same file name use the same internal array.
N.B. the filename case is significant to the function, even if the OS doesn’t care,
so `CSVRead(abc.txt,0)` and `CSVRead(aBc.txt,0)` would refer to different internal arrays.

The `*ALIAS` feature allows the same file to be opened more than once,
and also allows for shorter file names.

Each thread has its own internal pointer to its current row in the file array.
When a thread first refers to the file it will be allocated the next free row in
the array, so each thread will access a different row from all other threads.
[Unless there are more threads than there are rows in the array.]

> **Note**
> The function splits the line at every comma by default.
> If you want to enter columns containing commas, then you will need
> to change the delimiter to a character that does not appear in any
> column data, by setting the property: `csvread.delimiter`

| Name | Required | Description |
| --- | --- | --- |
| File Name | Yes | The file (or `*ALIAS`) to read from |
| Column number | Yes | The column number in the file.             `0` = first column, `1` = second etc.             “`next`” - go to next line of file.             `*ALIAS` - open a file and assign it to the alias |

For example, you could set up some variables as follows:

- COL1a `\${__CSVRead(random.txt,0)}`
- COL2a `\${__CSVRead(random.txt,1)}\${__CSVRead(random.txt,next)}`
- COL1b `\${__CSVRead(random.txt,0)}`
- COL2b `\${__CSVRead(random.txt,1)}\${__CSVRead(random.txt,next)}`

This would read two columns from one line, and two columns from the next available line.
If all the variables are defined on the same User Parameters Pre-Processor, then the lines
will be consecutive. Otherwise, a different thread may grab the next line.

> **Note**
> The function is not suitable for use with large files, as the entire file is stored in memory.
> For larger files, use [CSV Data Set Config element](/components/csv-data-set-config/)
> or StringFromFile.

### Example

```plaintext
${__CSVRead(data.csv,0)}   → column 0 of the current row
${__CSVRead(data.csv,1)}   → column 1 of the current row
${__CSVRead(*ALIAS,1)}     → reuse a file already opened under an alias
```

For the common case — feeding each thread a different row automatically — [CSV Data Set Config](/components/csv-data-set-config/) is simpler and is the element most test plans should reach for first. See the [CSV Data Set & Parameterization guide](/topics/csv-data-set-config-guide/).

## Related

- [Functions and Variables Guide](/topics/functions-and-variables/)
- [Regex Extractor Builder](/tools/regex-tester/)
- [CSV Data Set & Parameterization](/topics/csv-data-set-config-guide/)
- [CSV Data Set & Sharing Issues](/topics/errors/csv-data-set-file-not-found-sharing/)
- [Full Functions Reference](/user-manual/functions/)
- [Component Reference](/user-manual/component-reference/)
