SQLite Forum

Simple import csv file question
Login

Simple import csv file question

(1) By anonymous on 2021-05-18 21:59:09 [link] [source]

Hi,

What's the proper way to import a csv file into a table with SQLite?

https://sqlite.org/cli.html says:

Note that it is important to set the "mode" to "csv" before running the ".import" command.

Assume the table already exists...

Something like this?

sqlite> .mode csv
sqlite> .import mycsvfile.csv mytable

Does this also do the same thing?

.import --csv mycsvfile.cs mytable

Thanks!

(2) By Larry Brasfield (larrybr) on 2021-05-19 12:30:56 in reply to 1 [source]

I recommend a study of the CLI shell's output in response to: .help import . That will answer the questions you posed and another you might have.