Import your data into Neo4j

The goal of the following articles and tutorials is to help you understand how to import various types of data into Neo4j. From JSON to APIs to another database, you can retrieve data from nearly any source and use it to populate your graph.

Importing CSV files

One of the most common formats of data is in rows and columns on flat files. This spreadsheet format is used for a variety of imports and exports to/from relational databases, so it is easy to retrieve existing data this way.

You can also use this format of data for Neo4j. The LOAD CSV command in Cypher® allows us to specify a filepath, headers or not, different value delimiters, and the Cypher statements for how we want to model that tabular data in a graph.

We will walk through the details of how to take any CSV file and import the data into Neo4j.

Importing API data

There are now many data sources that use an API to expose data via a URL - many of these in JSON format. You can also import this type of data into Neo4j using the APOC standard extension library and executing the commands in the Neo4j Browser command line or in a script.

The apoc.load.json command allows us to specify a URL path and any necessary parameters, followed by Cypher statements to model that tree-like data in a graph.

This guide shows how to retrieve data from a JSON-based REST API and import it into Neo4j.

Importing data from a relational database to Neo4j

Many existing systems store data in relational or tabular types of formats. Knowing how to translate and migrate this data into graph data for analyzing the relationships can seem complex.

There are a variety of tools for migrating data from relational formats into graphs. In this article, we want to discuss all of the options and why you can or should choose some over others for your use case.

Tutorials

In the Appendix, you can find two tutorials on how to import data from the relational database and how to import CSV data with Neo4j Desktop.
The first guide uses a common relational data set (Northwind) and walks you through how to transform and import data from a relational database to Neo4j graph database. You will learn what steps are needed to retrieve the data from the relational data store and import the same data as a graph in Neo4j, as well as how to take the relational data model and convert it to graph in the process.