Error: Neo4jError: CSV file not found: file:..///news.csv

I was trying to load the csv file in my nodejs code.
Getting error Error: Neo4jError: CSV file not found: file:…///news.csv
at captureStacktrace (/home/amruthamsuresh/workspace/memgraph/workbench/node_modules/neo4j-driver-core/lib/result.js:611:17)
at new Result (/home/amruthamsuresh/workspace/memgraph/workbench/node_modules/neo4j-driver-core/lib/result.js:105:23)
at Session._run (/home/amruthamsuresh/workspace/memgraph/workbench/node_modules/neo4j-driver-core/lib/session.js:229:16)
at (/home/amruthamsuresh/workspace/memgraph/workbench/node_modules/neo4j-driver-core/lib/session.js:179:27)
at createNodes (/home/amruthamsuresh/workspace/memgraph/workbench/xmscsv.js:50:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
constructor: [Function: Neo4jError] { isRetriable: [Function (anonymous)] },
code: ‘Memgraph.TransientError.MemgraphError.MemgraphError’,
retriable: true
I have installed npm I neo4j-driver.

I am using ubuntu.
this is my full code.

const fs = require(‘fs’);
const csv = require(‘csv-parser’);
const neo4j = require(‘neo4j-driver’);
const path = require(“path”);
const { execSync } = require(‘child_process’);

// Function to parse the CSV file and return a Promise
function parseCSVFile(filePath) {
return new Promise((resolve, reject) => {
const results = ;
.on(‘data’, (data) => {
.on(‘end’, () => {
.on(‘error’, (error) => {

// Main function to connect to Memgraph and create nodes
async function createNodes() {
const driver = neo4j.driver(‘bolt://localhost:7687’);//, neo4j.auth.basic(‘your-username’, ‘your-password’));
const session = driver.session();

try {
const csvDir = path.join(__dirname, “…/news.csv”);
console.log(Importing data from ${csvDir});
const data = await parseCSVFile(csvDir);
// Copy the CSV file to the Memgraph Docker container
execSync(‘sudo docker cp /home/amruthamsuresh/workspace/memgraph/news.csv f60e60b1c260:/news.csv’);
// Process each row from the CSV data
for (const row of data) {
const genre = JSON.parse(row.genre);
const tags = JSON.parse(row.tags);
const name =;

  const query = `
    LOAD CSV FROM "file:..///news.csv" WITH HEADER IGNORE BAD AS row
    CREATE (news:News)
    SET news.genre = $genre,
        news.tags = $tags,
        news.title = $name;

  await, { genre, tags, name });
  console.log(`Created node for ${name}, ${tags}, ${genre}`);

} catch (error) {
console.error(‘Error:’, error);
} finally {

// Call the main function

Please i need help with this ASAP.

Hi @suresh_amrutham, are you sure “file:…///news.csv” is the correct path to the file?
Can you try copying it to this location: /usr/lib/memgraph/news.csv? and then using that path in the LOAD CSV file?

so change this line of code:
execSync(‘sudo docker cp /home/amruthamsuresh/workspace/memgraph/news.csv f60e60b1c260:/usr/lib/memgraph/news.csv’);

and this one:
LOAD CSV FROM "/usr/lib/memgraph/news.csv" WITH HEADER IGNORE BAD AS row

Let me know if that helps! :slight_smile:

Hi Katarina,
Nice to meet you.

Thanks for helping me out.
Your suggestions got worked.

1 Like