How do I view the column headers of a CSV file with LOAD CSV

If one has a CSV file with the following content

id,name,dob,addr1,addr2,city,state,country
1,Joe Smith,04/23/1971,121 Main Street,San Mateo,CA,USA
2,Bill Williams,09/21/2008,43 Overlook St,San Mateo,CA, USA

and one simply wants to run a LOAD CSV command to have the column headers returned, the following should suffice

load csv with headers from 'file:///test.csv' as row with row limit 1 return keys(row);

which will return output similar to

+---------------------------------------------------------------------+
| keys(row)                                                           |
+---------------------------------------------------------------------+
| ["country", "addr2", "city", "addr1", "dob", "name", "state", "id"] |
+---------------------------------------------------------------------+

  • Last Modified: 2020-09-30 15:12:37 UTC by Dana Canzano.
  • Relevant for Neo4j Versions: 3.4, 3.5.
  • Relevant keywords load-csv.