# CSV File

## Local CSV FIle Overview

The CSV File connector will load a CSV file into a local [SQLite](https://docs.chartsql.com/chartsql-studio/datasources/sqlite) database that can be visualized.&#x20;

{% hint style="info" %}
See the [sqlite](https://docs.chartsql.com/chartsql-studio/datasources/sqlite "mention")connector for details about querying SQLite for visualizations.
{% endhint %}

## Column Headers

The first row of the CSV is considered as headers for the columns. Ensure that your CSV has column headers.

## Column Data Types

The CSV data will be automatically inspected and the appropriate data type selected. All of the data in a column must resolve to the same type, or it will be considered a string.

The data types are checked in order of the following. If a Datetime, Date or Numeric is not found, the type will be string

1. Datetime
2. Date
3. Numeric
   1. Will also check for 'numberish' values (see [#numberish-values](#numberish-values "mention") below)
4. String
   1. If maximum length < 255, then data type will be VARCHAR with the length being the maximum length found

## Numberish Values

Many common real world number notations will be converted to numbers during import.&#x20;

* Negative parenthesis like (150) will be converted to -150
* Scientific notation like 10^2 will be converted to 100
* Thousands notation like 7.5k will be converted to 7500

{% hint style="info" %}
All number conversions are based on US/English comma/decimal standard. For example, international 1.200,5 will get converted to 1.2005 instead of 1200.5. As such, do not currently detect commas as decimal separators.
{% endhint %}

A full example list of conversions is described below:

<table><thead><tr><th width="271">RawInput</th><th width="227">ExpectedOutput</th><th width="287">Description</th></tr></thead><tbody><tr><td>100</td><td>100</td><td>Plain number</td></tr><tr><td>1,000</td><td>1000</td><td>Comma as thousand separator</td></tr><tr><td>$100</td><td>100</td><td>Dollar sign</td></tr><tr><td>€200</td><td>200</td><td>Euro sign</td></tr><tr><td>£300</td><td>300</td><td>Pound sign</td></tr><tr><td>50%</td><td>0.5</td><td>Percentage</td></tr><tr><td>(400)</td><td>-400</td><td>Parentheses for negatives</td></tr><tr><td>5k</td><td>5000</td><td>Text for thousands</td></tr><tr><td>7.5M</td><td>7500000</td><td>Text for millions</td></tr><tr><td>1,234.56</td><td>1234.56</td><td>Period as decimal separator</td></tr><tr><td>-100</td><td>-100</td><td>Negative sign</td></tr><tr><td>₹500</td><td>500</td><td>Indian Rupee sign</td></tr><tr><td>¥600</td><td>600</td><td>Yen sign</td></tr><tr><td>500₩</td><td>500</td><td>Won sign</td></tr><tr><td>200m</td><td>200000000</td><td>Text for hundreds of millions</td></tr><tr><td>1B</td><td>1000000000</td><td>Text for billions</td></tr><tr><td>2.5%</td><td>0.025</td><td>Decimal percentage</td></tr><tr><td>3,456.789</td><td>3456.789</td><td>Number with comma and period</td></tr><tr><td>(1,234.56)</td><td>-1234.56</td><td>Negative with comma and period</td></tr><tr><td>10^2</td><td>100</td><td>Scientific notation</td></tr><tr><td>2e3</td><td>2000</td><td>Exponential notation</td></tr><tr><td>-.5</td><td>-0.5</td><td>Leading decimal negative</td></tr><tr><td>.75</td><td>0.75</td><td>Leading decimal</td></tr></tbody></table>

## Externally Connecting to the SQLite Database

You may wish to connect to the imported CSV with another database browser like DBeaver. You can find the sqlite file in:&#x20;

./{{home}}/ChartSQL/{{installPath}}/db/csvfile/{{datasourceName}}/data.sqlite

Where as:&#x20;

* {{home}} is your system user data directory
* {{installPath}} is the location of your ChartSQL Studio Installation
* {{datasourceName}} is the name of your configured CSV Datasource


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chartsql.com/chartsql-studio/datasources/csv-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
