---
title: "Csv@1"
description: "Csv@1 — CSV files in a directory, simple filtering, no driver needed"
url: "https://docs.justcat.it/reference/data-sources/providers/csv-1/"
---
# Csv@1


## Connects to

CSV files — one data source covers every file in a directory. For full SQL over CSV data (joins, `GROUP BY`, `ORDER BY`, functions) use [Csv@2](https://docs.justcat.it/reference/data-sources/providers/csv-2/ "Csv@2"); `Csv@1` is the one that can also serve lists of definitions.

## Example


**Properties**



Name
: MyCsvData

Provider
: Csv@1

Technology
: Csv

Connection string
: .





**YAML**


```yaml
Data sources:
- Name: MyCsvData
  Provider: Csv@1
  Technology: Csv
  Connection string: . # this directory (where the project file is)
```




## Connection string

Not a connection string and not a file: **a path to a directory** where the CSV files are. A relative path is resolved against the directory of the project file. One data source can therefore serve hundreds of CSV files that sit in the directory under test. The same slot is also accepted as `Directory` or `Folder` — see [Data source properties](https://docs.justcat.it/reference/data-sources/properties/#connection-string "Data source properties").


**Properties**



Name
: generated CSVs

Provider
: Csv@1

Technology
: Csv

Connection string
: T:\MySystemTests\GeneratedCsvFiles





**YAML**


```yaml
Data sources:
- Name: generated CSVs
  Provider: Csv@1
  Technology: Csv
  Connection string: "T:\\MySystemTests\\GeneratedCsvFiles"
```




The file itself is named in the query: `SELECT * FROM [2020.csv]`, `SELECT * FROM [2021.csv]` and so on.

## Settings

| Setting | Default | Meaning |
|---|---|---|
| `Encoding` (also `Encoding name`, `Charset`) | `utf-8` | Text encoding of the files, parsed with .NET `System.Text.Encoding.GetEncoding` — any value from the *Name* column of the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding?view=net-7.0" target="_blank">.NET encoding list</a> ("List of encodings" section), e.g. `windows-1250`, `utf-32` |


**Properties**



Name
: MyCsvData

Provider
: Csv@1

Technology
: Csv

Connection string
: .

Encoding
: utf-32





**YAML**


```yaml
Data sources:
- Name: MyCsvData
  Provider: Csv@1
  Technology: Csv
  Connection string: . # this directory (where the project file is)
  Encoding: 'utf-32' # or windows-1250, ...
```




This is what the .NET documentation looks like — use the *Name* column:

![Encoding names](encoding-names.png)

## Query

A SQL statement, even though no database is involved — CAT needs it to know which file to read, because the connection string names only the directory. Only these clauses are supported:

| SQL clause | Notes |
|---|---|
| `SELECT` | Either `*` or a comma-separated list of column names in square brackets. The columns may be listed in a different order than in the file. |
| `FROM` | Just the name of a file in the directory given by the connection string. No joins. |
| `WHERE` | Only `[Column name] = 'something'`; several conditions joined with `AND`. No functions, no `OR`, no brackets — simple filtering on one or more columns. |

```sql
SELECT  [Last Name], [First name]
FROM    [Data.csv]
WHERE   [First Name] = 'Helena' AND [ID] = 2
```

## Prerequisites

None. The driver ships with CAT. Windows; on Linux it has no extra dependencies and is expected to work, but it has not been tested there.

## Serving test and data source definitions

`Csv@1` can also serve [lists](https://docs.justcat.it/reference/project-file/lists/ "Lists") of definitions: a CSV file whose header row carries the property names of a [test](https://docs.justcat.it/reference/tests/properties/ "Test properties"), [data source](https://docs.justcat.it/reference/data-sources/properties/ "Data source properties") or [query](https://docs.justcat.it/reference/queries/properties/ "Query properties") definition, one definition per row; the query's `FROM` names the file.

## Related

* [Technologies](https://docs.justcat.it/reference/data-sources/technologies/ "Technologies") — CSV file and the provider behind it.
* [Csv@2](https://docs.justcat.it/reference/data-sources/providers/csv-2/ "Csv@2") — full SQL over CSV files, no driver either.
* [Lists](https://docs.justcat.it/reference/project-file/lists/ "Lists") — loading test and data source definitions from a provider.

