cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cypher Load CSV fail - there's a field starting with a quote and whereas it ends

I'm using AuraDB free tier.

Trying to import the following csv file with Cypher:

messagetime,correlatioId,messageIntent,messageType,originatingEndpoint,processingEndpoint,timestamp
a,b,c,d,e,f,g

Cypher command:

LOAD CSV WITH HEADERS FROM 'https://www.dropbox.com/s/i5enrzq1imhknab/sendCommandsMini.csv?dl=0' AS relRecords FIELDTERMINATOR ','
RETURN linenumber() AS number, relRecords
 
Result:
At https://www.dropbox.com/s/i5enrzq1imhknab/sendCommandsMini.csv?dl=0 @ position 8022 -  there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what I read: 'number"!'

Tried hosting with github and drive, same problem

At https://drive.google.com/file/d/1OkZBSQADIB-912mPyb49FTuPhnkvrV6g/view?usp=sharing @ position 18698 -  there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what I read: 'error")'

 Please help,

 

1 ACCEPTED SOLUTION

When the URL is requested, the response should be the CSV as a raw file.

For the Google Drive URL, you can enforce raw download for the file by requesting the URL in the below format:
'https://drive.google.com/uc?id=<google_file_id>&confirm=t'

So your Cypher would be:

LOAD CSV WITH HEADERS FROM "https://drive.google.com/uc?id=1OkZBSQADIB-912mPyb49FTuPhnkvrV6g&confirm=t" AS relRecords FIELDTERMINATOR ','
RETURN linenumber() AS number, relRecords

View solution in original post

3 REPLIES 3

When the URL is requested, the response should be the CSV as a raw file.

For the Google Drive URL, you can enforce raw download for the file by requesting the URL in the below format:
'https://drive.google.com/uc?id=<google_file_id>&confirm=t'

So your Cypher would be:

LOAD CSV WITH HEADERS FROM "https://drive.google.com/uc?id=1OkZBSQADIB-912mPyb49FTuPhnkvrV6g&confirm=t" AS relRecords FIELDTERMINATOR ','
RETURN linenumber() AS number, relRecords

Thanks so much, I used your recommendation and it worked.
PS. For those of you that have the same issue, please also make sure to give permission to anyone with the link to view the file.


The correct syntax using Dropbox is using the "dl=1" flag. This indicates to download the file as raw.


LOAD
 CSV WITH HEADERS FROM 'https://www.dropbox.com/s/i5enrzq1imhknab/sendCommandsMini.csv?dl=1' AS relRecords FIELDTERMINATOR ','
RETURN linenumber() AS number, relRecords

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online