Loading CSV with Cypher with certain column names as properties

I have a CSV like this with the first row being header (H1, H2, H3,...) -


I already have a neo4j database in which I use the first column (H1) to merge the nodes and use the rows of H2 and H3 to create a new node. When I strip off the header row, my code looks like this -

LOAD CSV FROM 'file:///mycsv.csv' AS row
MERGE (a:existingNode {name:row[0]})
CREATE (b:NewNode {name1:row[2], name2: row[1], name3: row[0]})
MERGE (a)-[:isAssociated]->(b)

How do I import the CSV so that the rest of the headers H4, H5,... are set as properties of the created node (based on H2 and H3) without having to assign each header under the created node? I want the header names as properties. Thanks.

I have not tried this, but two suggestions to try:

Maybe you can use the APOC map functions (10.2. Map Functions - Chapter 10. Utility Functions) to build a map with keys and values and set the properties like this:

CREATE (b:NewNode)
SET b = propertymap

OR using APOC load csv (Neo4j APOC Procedures User Guide) instead of LOAD CSV and get the columns as a map directly:

CALL apoc.periodic.iterate('
CALL apoc.load.csv('/mycsv.csv', {header:true, mapping:{H4:{type:'int/string/...'}, H5:{type:'int/string/...'}}) YIELD map RETURN map
MERGE (a:existingNode {name:row.H1})
WITH a, map
CALL apoc.map.removeKeys(map,["H1"]) 
CREATE (b:NewNode)
SET b = map
MERGE (a)-[:isAssociated]->(b)
', {batchSize:10000, iterateList:true, parallel:true});

Thank you very much. I will certainly try and get back if I get into issues.