Course

LOAD CSV Data Import

Master Neo4j's LOAD CSV clause in a hands-on lab. Read CSV files row by row, convert types, connect nodes, and build imports you can safely re-run.

40 minutes6 lessons across 1 module
About this lab

In this 40-minute lab, you will learn

LOAD CSV is the Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. clause that turns flat files into graphs. It reads a CSV file row by row and hands each row to the rest of your query, where MERGE and CREATE do the work of building Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. and Full definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node.. Because it runs anywhere Cypher runs, it is the most portable way to import CSV data into Neo4j: no extra tools, no separate pipeline, just a query.

In this hands-on lab, you will use LOAD CSV to populate an empty Neo4j database with a graph of movies, people, and the roles that connect them. You will work through the clause from first principles to a complete, re-runnable import. Every technique is one you will reuse the next time someone hands you a folder of CSV exports and asks for a graph.

  • LOAD CSV fundamentals

    Read CSV files, inspect headers, and understand how Neo4j processes rows.

  • Data type conversions

    Convert CSV string values to integers, floats, and lists using built-in Cypher functions.

  • Creating relationships from CSV

    Use MATCH and MERGE patterns to connect nodes from separate CSV sources.

  • Idempotent import pipelines

    Design imports that can be safely re-run without creating duplicates.

  • Error handling and missing data

    Filter out incomplete rows, handle null values with coalesce, and batch large imports for resilience.

  • Who this course is for

    This lab is for anyone who wants to learn the LOAD CSV clause itself, in depth and by doing: developers who prefer working in code over a visual tool, analysts who receive data as CSV exports and need it queryable as a graph, and learners who have finished the Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. basics and want a concrete project. You should be comfortable with the basic Cypher taught in Neo4j Fundamentals and Cypher Fundamentals, since the import Full definition for pattern (opens in a new tab)A graph structure written in Cypher, such as a node joined to another node by a relationship. here combine LOAD CSV with MATCH, MERGE, and WHERE. The lab is short and entirely hands-on: you spend the 40 minutes writing and running import statements against your own database.

  • What you'll do

    You will start with an empty database and finish with a connected movie graph, built entirely with Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. you wrote yourself. First you will learn how LOAD CSV actually works: how it fetches a file from a URL, how WITH HEADERS turns each row into a map keyed by column name, and how Neo4j processes the file one row at a time. You will then import Person and Movie Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. with correctly typed Full definition for property (opens in a new tab)A named value stored on a node or a relationship. using conversion functions such as toInteger() and toFloat(), and use MATCH to find nodes by identifier and create the Full definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node. between them.

    The second half of the lab is about robustness. You will make your import idempotent, replacing CREATE with MERGE so re-running a statement cannot produce duplicates, filter out rows with missing values with WHERE, supply defaults with coalesce(), and batch large imports. The lab closes with a final challenge: importing a complete dataset in a single, end-to-end pipeline.

  • Where to go next

    The Full definition for pattern (opens in a new tab)A graph structure written in Cypher, such as a node joined to another node by a relationship. in this lab scale directly to your own data: swap the movie files for your CSV exports and the same statements apply. Importing CSV data into Neo4j goes further with Cypher-based importing, covering list Full definition for property (opens in a new tab)A named value stored on a node or a relationship., adding Full definition for label (opens in a new tab)A tag on a node that groups it with other nodes of the same kind. A node can carry more than one. from data, and managing Full definition for transaction (opens in a new tab)A unit of work that either succeeds in full or leaves no trace. with CALL { ... } IN TRANSACTIONS, while Importing Data Fundamentals introduces the Neo4j Full definition for Data Importer (opens in a new tab)The Neo4j tool for loading CSV files into a graph by mapping their columns onto nodes and relationships., the visual alternative. LOAD CSV also appears on the Neo4j Certified Professional exam, so the practice you get here counts directly toward earning that certification.