Loading CSV
LOAD CSV
Read a CSV resource and emit one row per record — a row source, like UNWIND.
// Without headers: `row` is a LIST of field strings.
LOAD CSV FROM 'file:///data/people.csv' AS row
RETURN row[0], row[1];
// With headers: `row` is a MAP of header name -> field string.
LOAD CSV WITH HEADERS FROM 'people.csv' AS row
CREATE (:Person {name: row.name, age: toInteger(row.age)});
// A custom delimiter:
LOAD CSV WITH HEADERS FROM 'people.tsv' AS row FIELDTERMINATOR '\t'
RETURN row.name;
- Sources: a local filesystem path, a
file://URL, or a plainhttp://URL.https://is not supported — download the file and load it by path. - Every field is a STRING. Convert with
toInteger()/toFloat()/date()etc.. - Quoting is RFC 4180: a field may be
"quoted"; inside quotes the delimiter,,and newlines are literal and a doubled""is one".LF,CRandCRLFline endings are all accepted. - With headers, a record with fewer fields than headers maps the missing ones to
null; an unterminated quoted field is an error. - Ordinary LOAD CSV materialises its result. A direct
LOAD CSV ... CALL { ... } IN TRANSACTIONS OF 1000 ROWSstreams input and commits each batch independently. See Batched subqueries and logical interchange.
Related articles
Backup, restore and transfer · Transactions and concurrency · Server configuration