Load CSV difficulty

(Michael Aikenhead) #1

Hi all,

I'm new to Neo4j but in order to learn Cypher have manually built and manipulated some graphs. I'm now wanting to expand this and have more data to play with, and so have been trying to load some CSV files. I've been using both a Neo4j sandbox (v3.3.0) and my own GCP hosted install (v3.5.1) in order to cross-check and try and self-diagnose my difficulty.

I've downloaded the example Northwind customer CSV (from GitHub) and put it on Dropbox, and I then run the below Cypher:

LOAD CSV WITH HEADERS FROM 'https://www.dropbox.com/s/5jzu4q3yy6zv3jt/customers.csv' AS line
CREATE (:Customer {CustomerID: line.CustomerID, CompanyName: line.CompanyName, ContactName: line.ContactName, ContactTitle: line.ContactTitle, Address: line.Address, City: line.City, Region: line.Region, PostalCode: line.PostalCode, Country: line.Country, Phone: line.Phone, Fax: line.Fax})

This does not create the expected 91 Customer nodes, each with multiple properties, but instead Neo4j returns:

Added 186 labels, created 186 nodes, completed after 1328 ms.

None of the nodes have any properties.

I must be doing something obviously wrong but just can't spot it ... Can anyone assist?

Many thanks,

Michael

0 Likes

(Michael Aikenhead) #2

Ok, sleeping on it and a morning coffee has resolve this.

The issue was not having the correct URL format in the LOAD CSV command. Dropbox needs:
?dl=1
at the end of the URL to tell the system to download the file.

Hope that saves someone else some time!

1 Like