SQLite Forum

How to set the column separator for the CSV extension in the CLI?
Login
File `ext/misc/csv.c` mentions support for separators other than ",". But I haven't found how to set the separator in the CLI. I tried `.separator "\t"` before `.load csv`, but the CSV extension seemingly ignores it when it creates a table with `CREATE VIRTUAL TABLE`.

Full replication (that doesn't work):

File `test_tsv.sql`:

```
.separator "\t"
.load csv
CREATE VIRTUAL TABLE temp.t1 USING csv(filename="sample.tsv");
.mode columns
.header on
select * from t1;
```

Tested with:

```
echo -e "col_text\tcol_int\nMary\t1\nJohn\t2" > sample.tsv
sqlite3 '' < test_tsv.sql
```

Output:

```
c0                     
----------------       
col_text        col_int
Mary    1              
John    2              
```