cancel
Showing results for 
Search instead for 
Did you mean: 

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

isisdesade
Node Link

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

2 REPLIES 2

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.