Load Nodes with different properties

I have CSV file in the following format:

I need to create 3 nodes where column AttiibuteName1 and AttiibuteName2 defines the name of the property that should be created and AttributeValue1 and AttributeValue2 defines the value of the property.
For example Node with name Step1 has property named "a" with value "1" and property named "c" with value "4".

My question is how to create the nodes with the changing property names.

Here isthe link to the data

Thank you,

To create dynamic properties you'll need to use the APOC library's apoc.create.setProperty procedure - https://neo4j.com/docs/labs/apoc/current/graph-updates/data-creation/

The following code should do what you want, where I've put the CSV file into the import directory of the database:

load csv with headers from "file:///data.csv" AS row
MERGE (step:Step {id: row.StepID})
WITH step, row
CALL apoc.create.setProperty(step, row.AttiibuteName1, row.AttributeValue1)
YIELD node AS node1
CALL apoc.create.setProperty(step, row.AttiibuteName2, row.AttributeValue2)
YIELD node AS node2
RETURN node2
1 Like