I use the following code to create a database of my CSV file. My CSV has several columns but after running the script it only creates the first column which is UniID, but not the rest.
// Define constraints and indices
CREATE CONSTRAINT Uni_id IF NOT EXISTS FOR (p:Uni) REQUIRE (p.UniID) IS UNIQUE;
CREATE INDEX IF NOT EXISTS FOR (p:Uni) ON (p.Hochschulname);
// Import persons
LOAD CSV WITH HEADERS FROM 'file:///unis.csv' AS row
CREATE (:Uni {
UniID: toInteger(row.UniID),
Hochschulname: CASE row.hochschulname WHEN "" THEN null ELSE row.hochschulname END,
Land: CASE row.land WHEN "" THEN null ELSE row.land END,
Type: CASE row.type WHEN "" THEN null ELSE row.type END,
Hochschultype: CASE row.hochschultype WHEN "" THEN null ELSE row.hochschultype END,
Year: CASE row.year WHEN "" THEN null ELSE toInteger(row.year) END,
Anzahl: CASE row.anzahl WHEN "" THEN null ELSE toInteger(row.anzahl) END
})
Neo4j is case-sensitive so you need to ensure that the header is correct case.
Instead of row.hochschulnam use row.Hochschulnam and so on. When the header name is not match on your query, the values are NULL thus the properties becomes blank.
Hochschulname: CASE row.Hochschulname WHEN "" THEN null ELSE row.Hochschulname END