> For the complete documentation index, see [llms.txt](https://www.csvpath.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.csvpath.org/getting-started/quickstart.md).

# Quickstart

Get started managing CSV, JSON, Excel, XML, and JSONL file validation and live objects and DataFrames ingestion with less manual effort, lower risk, and greater predictability.

This page gives you all the information you need to get started doing simple validations. For a fast start we'll simply validate a CSV file. The basic pattern is the same for JSON, DataFrames, using ODCS, etc. You will want to go deeper on [other pages](https://www.csvpath.org/topics/how-tos.md). Here we're just doing the simplest possible thing that gives you a taste.

{% hint style="warning" %}
For an **even quicker start**, download the free **FlightPath Data** app from [Microsoft](https://apps.microsoft.com/detail/9P9PBPKZ4JDF) or [Apple](https://apps.apple.com/us/app/flightpath-data/id6745823097) or [Github](https://github.com/dk107dk/flightpath).&#x20;

FlightPath is the open source frontend to CsvPath Framework. It is your CSV/Excel file feed development and operations cockpit. When you open FlightPath you will see [these examples that you can immediately run](https://www.csvpath.org/topics/how-tos/validating-csv-and-excel/the-flightpath-data-examples.md).
{% endhint %}

{% hint style="info" %}
If you need help getting started with Python, try [Python.org's intros](https://www.python.org/about/gettingstarted/). Starting with a project tool like [Poetry](https://python-poetry.org/docs/basic-usage/) or [Jupyter Notebooks](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/) can also help.
{% endhint %}

{% hint style="success" %} <mark style="color:green;">Feel like skipping the Python?</mark> [Watch these videos](https://www.youtube.com/@atesta-analytics) <mark style="color:red;">🎥</mark> or [try this Python-free CLI example](https://www.csvpath.org/topics/how-tos/validating-csv-and-excel/your-first-validation-the-lazy-way.md)**.**
{% endhint %}

### PyPI and Github

[The open source CsvPath Framework](https://github.com/csvpath/csvpath) is available through [PyPI](https://pypi.org/project/csvpath/) as `csvpath`. The project is quite active. You should pin the version you use but update it regularly.&#x20;

We use Poetry for our own development. If you choose Poetry, all you need to do is:&#x20;

```
poetry new <<your project name>>
cd <<your project name>>
poetry add csvpath
```

If you prefer Pip, install CsvPath Framework with:

```
pip install csvpath
```

Note that DataFrames support requires installing the Framework with the `pandas` extra.&#x20;

{% code lineNumbers="true" %}

```python
pip install 'csvpath[pandas]'
```

{% endcode %}

Have a look at the [Github project](https://github.com/dk107dk/csvpath) for more details. That site focuses mainly on CsvPath Validation Language (CVL) and more getting started examples.

<div data-full-width="false"><figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FlK4zcW44dL2lBE5tj2HT%2Fgithub-home.png?alt=media&amp;token=fa61c0bb-a3ae-421e-88ab-0ed79d674620" alt="Screenshot of the open source CsvPath Framework&#x27;s GitHub page" width="375"><figcaption></figcaption></figure></div>

### Let's run something!

The worker class in CsvPath Framework is unsurprisingly called `CsvPath`. A `CsvPath` instance handles a single validation statement. For simple validations, it is all you need. &#x20;

{% hint style="warning" %}
For more complex situations and DataOps automation we use the manager class `CsvPaths`. (Note the plural form). But we'll come back to that in later pages. For now just know that it exists, has essentially the same API, and is equally lightweight to use.
{% endhint %}

The quickest way to bootstrap a CsvPath Framework project is the command line interface (CLI). The CLI is a super simple tool that is great for fast no-code development. To try the CLI, skip over to [Your First Validation, The Lazy Way](https://www.csvpath.org/topics/how-tos/validating-csv-and-excel/your-first-validation-the-lazy-way.md).&#x20;

{% hint style="info" %}
While we still find the CLI useful for simple stuff, the [**FlightPath Data**](https://www.flightpathdata.com/) app is vastly superior in all kinds of ways. Starting with the CLI makes sense for a first look. But also check out FlightPath Data — it's free, open, all-platforms, and awesome.&#x20;
{% endhint %}

To continue with the simplest possible Python, let's do a *hello world*.&#x20;

Create a script file and import CsvPath:&#x20;

<figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FxO63w6V5FnZ8F98rHQWy%2Fimport.png?alt=media&amp;token=e2e8ca7d-6197-4f15-9073-ce54e19a466c" alt="" width="375"><figcaption><p>Add CsvPath to your requirements.txt or dependency manger first, of course!</p></figcaption></figure>

```python
from csvpath import CsvPath
```

Create a test CSV file. Save it as trivial.csv or whatever name you like.

<figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FbtEINwGNGcsCFYc2UyTz%2Fcsv.png?alt=media&amp;token=1ed3e9a7-17c0-42f9-8a59-756040551f8a" alt="A trivial CSV file to do a simple intro validation using CsvPath Language" width="359"><figcaption></figcaption></figure>

{% file src="/files/5tc23tVYmWUjAgKd01nx" %}

Make a csvpath statement in CsvPath Validation Language (CVL). Just a trivial one to keep it simple.

<figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FUg2ElpdDErco7BVdkoA3%2Ftrivial-csvpath.png?alt=media&amp;token=202250c0-a23b-46d9-aa3a-15b7d51b5b6a" alt="A trivial CsvPath Language validation statement. This statement can validate a CSV or Excel file." width="563"><figcaption></figcaption></figure>

```python
csvpath = """$trivial.csv[*][yes()]"""
```

This path says:&#x20;

* Open `trivial.csv`
* Scan all the lines
* Match every one of them

<figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FWeyOSCrZIB6bP3WQb4uj%2Ffirst_script.png?alt=media&amp;token=d01055d1-ab4c-4b40-a73a-0972bf65f0ae" alt="A screenshot of the Python to run the validation file. It is the same as the code below." width="563"><figcaption></figcaption></figure>

Here's everything:

{% code lineNumbers="true" %}

```python
from csvpath import CsvPath

path = """$trivial.csv[*][yes()]"""

cp = CsvPath()
cp.fast_forward(path)

if cp.is_valid:
    print("Totally valid!")
else:
    print("Not valid.")    
```

{% endcode %}

What does this script do?

* **Line 1:** imports `CsvPath` so we can use it
* **Line 3:** is our CVL statement that we'll use to validate our test file, `trivial.csv`
* **Line 6:** fast-forwards though the CSV file's lines. We could also step through them one by one, if we wanted to.&#x20;
* **Line 8:** checks if we consider the file valid. If the file didn't meet expectations our csvpath would have declared the file invalid using the `fail()` function.&#x20;

When you run your script you should see something like:

<figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2Fq5JmxmZ4gn3bhne7K15u%2Fresult.png?alt=media&amp;token=066f3c93-f3b3-491f-ac73-afdea47ee4ff" alt="A screenshot of what you should see when you run your validation." width="324"><figcaption></figcaption></figure>

Hello-world examples are never super impressive on their own. But you are now ready to dig in and see what CsvPath Framework can really do.&#x20;

Next, try [Your First Validation, the Lazy Way](https://www.csvpath.org/topics/how-tos/validating-csv-and-excel/your-first-validation-the-lazy-way.md). Also check out the [How-tos section](https://www.csvpath.org/topics/how-tos.md) for more detailed use cases using ODCS, JSON, and much more. If you'd like a helping hand, [contact us](https://www.csvpath.org/getting-started/a-helping-hand.md)!
