Search code examples
memgraphdb

How to import CSV file (LOAD CSV) from a remote location?


I have my CSV data stored on a server that can be accessed via the internet. There is no authorization needed for access to that file. At the moment, I use scp and some crone jobs to copy that file to my Memgrpah server. Then I import data using LOAD CSV.

Is there a way to do something like LOAD CSV FROM "https://my-server.com/files/state.csv" NO HEADER AS row?


Solution

  • This can be done using the LOAD CSV:

    LOAD CSV FROM <csv-location> ( WITH | NO ) HEADER [IGNORE BAD] [DELIMITER <delimiter-string>] [QUOTE <quote-string>] [NULLIF <nullif-string>] AS <variable-name>
    

    <csv-location> can be used for http, https and ftp based URLs.