Where can I host a csv so I can directly read it into a neo4j database?

Viewed 5071

I have a csv and I want to read it directly into a Neo4J database. I'm envisioning something along the lines of:

LOAD CSV WITH HEADERS FROM
'file:///somewhere_accessable_to_anyone/some_csv.csv' line AS

I tried the public folder in my Dropbox but that just gives a link to the csv.

I've tried some file hosting sites and again, they just want to host the file with a link that is accessible to click on for download, and displayed on an ad-packed page.

Has anyone found a good way to do this?

6 Answers

As for a Google Drive approach, you don't even need to first open the CSV file in Sheets. Simply click the CSV to view it

enter image description here

Take note of the FILE_ID (highlighted in blue above) and add it the URL below as follows

https://drive.google.com/uc?export=download&id=FILE_ID

This url is a direct link to the file download which tools like Neo4j or pandas.read_csv() can use.

After searching for hours, I finally found the solution that worked.

The best option is through Google Spreadsheet

  1. Host the file on Google drive
  2. Navigate to the file and open in Google Sheets
  3. Click on File > Share > Share with others > Change to anyone with the link > Done
  4. In the address bar, you will notice a link like this https://docs.google.com/spreadsheets/d/1T0OygJBMcStdC7dTP0CKofEr3dCTsMcRJho/
  5. Just copy the part after 'd' which is 1T0OygJBMcStdC7dTP0CKofEr3dCTsMcRJho in our case.
  6. Now, plug in the key we copied above in https://docs.google.com/spreadsheets/d/{copied_key_here}/gviz/tq?tqx=out:csv
  7. Hence, in our case, the link will be https://docs.google.com/spreadsheets/d/1T0OygJBMcStdC7dTP0CKofEr3dCTsMcRJho/gviz/tq?tqx=out:csv

We now have the link ready

Open Neo4j Aura Console and click Neo4j Browser and connect with your credentials enter image description here

Next run the following query to test

LOAD CSV FROM 'https://docs.google.com/spreadsheets/d/1T0OygJBMcStdC7dTP0CKofEr3dCTsMcRJho/gviz/tq?tqx=out:csv' AS ROW RETURN ROW LIMIT 10

enter image description here

Credits: Using Google Sheets to Host Editable CSV Files

Direct URLs for Github Files

After the file has been uploaded to Github, click the filename in the list and you’ll get the file’s URL in the browser’s address. Append ?raw=true to the URL and you get a downloadable version.

You can use that url in your fetch api like fetch, axios, ajax etc.

2022 answer:

Google sheets now has a built in Publish to web option. Create your sheet with data then Go to File -> Share -> Publish to web

From the dialog: Choose the tab of the sheet you want to host and the format you are publishing to e.g. CSV. Then click the Publish button. The URL is shown on the dialog.

Related