4
votes

I saved my csv file on dropbox and I want to Load them on Neo4j.

The link for the shared Users Node csv file: https://www.dropbox.com/s/6kibjeea5e4cks1/users.csv?dl=0

This is the cypher

USING PERIODIC COMMIT 100

LOAD CSV WITH HEADERS FROM "https://www.dropbox.com/s/6kibjeea5e4cks1/users.csv?dl=0" AS line

CREATE(u:User{userId: toInt(line.Id), username: line.UserName, fullname: line.FullName})

The Neo4j version I am using is Neo4j Enterprise version 3.0.9.

The result showed that it successfully created the Users Node but it created over 300 Nodes with no user name and fullname even though are 9 nodes with user name and full name on the CSV file. What am I missing?

I tried to change the url from the shared link to the download link but the error Couldn't load the external resource showed up.

3
I am on Neo4j 3.1.5, and I can reproduce your error with the Dropbox link. If I am putting the file into the import folder and run the LOAD CSV from local file it works as expected.Fabio Lamanna
@Fabio I can't put the file in to import folder because the Neo4j server is on azure. Or is there away that I can do this on Neo4j Server deployed on azureash

3 Answers

4
votes

If you switch from dropbox to gDrive the issue seems to not be an issue. I dropped your csv in my drive account and it seems to work.

USING PERIODIC COMMIT 100
LOAD CSV WITH HEADERS FROM "https://docs.google.com/spreadsheets/d/e/2PACX-1vRANVgt-GZf0Un8dyrf7YPITDgAIBzTwjTcqOu_G7mBhGKOEZskf6Mt2oTdInyQ-wLPE0aOzsW6lVD_/pub?gid=5399540&single=true&output=csv" AS line
CREATE(u:User{userId: toInt(line.Id), username: line.UserName, fullname: line.FullName})

File > Publish to the web

enter image description here

  1. Pick the tab you want
  2. Select csv as the published format
  3. Click Publish

And you will get back a public url to the csv

enter image description here

3
votes

The link you are using is not the file by itself, but the dropbox page to see the file :

$ curl -i --raw https://www.dropbox.com/s/6kibjeea5e4cks1/users.csv?dl=0
HTTP/2 302
server: nginx
date: Mon, 24 Jul 2017 14:46:44 GMT
content-type: text/html; charset=utf-8
content-length: 0
location: https://dl.dropboxusercontent.com/content_link/Z2KG0dzjBlHuMnIXyApZvBZFICVBXnLErAeLwlrkH46xnjg5yfd59ZfboKUpCNdo/file

You should try with the file direct link :

$ curl -i --raw https://dl.dropboxusercontent.com/content_link/Z2KG0dzjBlHuMnIXyApZvBZFICVBXnLErAeLwlrkH46xnjg5yfd59ZfboKUpCNdo/file
HTTP/2 200
server: nginx
date: Mon, 24 Jul 2017 14:47:46 GMT
content-type: text/csv; charset=utf-8
content-length: 231
3
votes

This occurs because the link https://www.dropbox.com/s/6kibjeea5e4cks1/users.csv?dl=0 returns a HTML page instead of a CSV file.

Take a look in this Cypher query:

LOAD CSV WITH HEADERS FROM "https://www.dropbox.com/s/6kibjeea5e4cks1/users.csv?dl=0" AS line
RETURN line LIMIT 3

The output:

╒══════════════════════════════════════════════════════════════════════╕
│"line"                                                                │
╞══════════════════════════════════════════════════════════════════════╡
│{"<!DOCTYPE html><html lang=\"en\" xmlns:fb=\"http://ogp.me/ns/fb#\" x│
│ml:lang=\"en\" class=\"maestro\" xmlns=\"http://www.w3.org/1999/xhtml\│
│">":"<head><link href=\"https://cfl.dropboxstatic.com/static/css/accou│
│nt/emails-vflCV9b0W.css\" type=\"text/css\" crossorigin=\"anonymous\" │
│rel=\"stylesheet\" />"}                                               │
├──────────────────────────────────────────────────────────────────────┤
│{"<!DOCTYPE html><html lang=\"en\" xmlns:fb=\"http://ogp.me/ns/fb#\" x│
│ml:lang=\"en\" class=\"maestro\" xmlns=\"http://www.w3.org/1999/xhtml\│
│">":"<link href=\"https://cfl.dropboxstatic.com/static/css/deprecated/│
│components/multiaccount_login_modal-vflNhUM8J.css\" type=\"text/css\" │
│crossorigin=\"anonymous\" rel=\"stylesheet\" />"}                     │
├──────────────────────────────────────────────────────────────────────┤
│{"<!DOCTYPE html><html lang=\"en\" xmlns:fb=\"http://ogp.me/ns/fb#\" x│
│ml:lang=\"en\" class=\"maestro\" xmlns=\"http://www.w3.org/1999/xhtml\│
│">":"<link href=\"https://cfl.dropboxstatic.com/static/css/font_paper_│
│atlas_grotesk-vflEbKJso.css\" type=\"text/css\" crossorigin=\"anonymou│
│s\" rel=\"stylesheet\" />"}                                           │
└──────────────────────────────────────────────────────────────────────┘

To solve it try getting the direct download link from DropBox (if it is possible) or change to another storage tool.