Cannot access map item from apoc.load.csv

this being the content of my "taxonomy.CSV" file:

Level1,Level2,Tree Path,Id,Code,Description,Long Description,Context,Type,Active,Code Valid from,Node Valid from,Node Valid to
1,1,(Root Code),31102727,Zone,Zone,,TEST,Taxonomy,A,31/01/2020,,

by running
CALL apoc.load.csv('taxonomy.csv') yield map return map,map['Id'],map['Tree Path'],map['Level1'],map['Level2'] limit 5

I cannot access the values on the first column - they are always null.
I've tried renaming the column -> same (=null).
I've duplicated the column, initially called "Level" and new it's Level1 and Level2 and Level2 can be access, but Level1 is always null

Result (removed some content from map to make used fields more visible):

  "Tree Path": "(Root Code)",
  "Level2": "1",
  "Level1": "1",
  "Id": "31102727"
map['Id']	map['Tree Path']	map['Level1']	map['Level2']

"31102727"	"(Root Code)"	null	"1"

Is there some parameter i am missing, some little frustration disabler flag i need to use?

@gabriel_toma have you tried map.Id, map.Level1, map.Level2 ?
LOAD CSV WITH HEADERS makes the fields accessible in this way. I'm ASSUMING that apoc.load.csv uses the same logic underneath.

well, the reason I use the apoc variant is that LOAD CSV only outputs just "line", whereas for apoc.load.csv also outputs the map of the line, which I can use to setup the node immediately, using set p = map (p being the new node).
With LOAD CSV I would need to individually access each and every attribute, which is a no-go for my purpose.

If you use WITH HEADERS it gives you a map as well.... or it does for me (v 3.5.17 enterprise)

pretty standard pattern for us is to import a row, parse the fields that need formatting, then load the rest into the Node.

'' AS line
SET n += line
1 Like

Thanks, Mike, will try this.

Hi Gabriel,

Hi have experienced the same problem accessing the first column when using apoc.load.csv.
Using the classical LOAD CSV including the statemen 'WITH HEADERS' is definitely an option. But not in my case. Apoc.load.csv also return with an index per line, which is crucial in my case. Classicla LOAD CSV does not provide this index per line. So I am still stuck, due this potential buck within apoc.load.csv
My workaround: I am adding an empty column at left of my csv file BEFORE running apoc.load.csv

Thank you, Markus
In the end, I did the same (adding a column before the first column)
Opened First CSV column not accessible if using apoc.load.csv · Issue #12587 · neo4j/neo4j · GitHub

Can you folks please check if you have a byte order mark character at the beginning of your file? That could potentially pollute the header string.
Maybe use hexdump or similar tools to inspect.
To get rid of BOM run

sed '1s/^\xEF\xBB\xBF//' < orig.txt > new.txt

Hello Stefan,
As I don't have sed installed, could you please be so kind to check attached file? (314 Bytes)
You may have to remove ".txt" from file name before unarchiving.