cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Excel file with 3-row header?

mbandor
Graph Voyager

I have an Excel file I want to ingest use APOC. The file unfortunately has a 3-row header, although the actual header info I'm looking for as a header starts on row 3. Is there a way to tell APOC I have a head but to skip the first 2 rows of it?

3 REPLIES 3

glilienfield
Ninja
Ninja

Looks like both import and load cvs methods have configuration parameters to skip lines.

You can even skip rows using cypher too

Load cvs with headers from “file name” as row
with row
skip 2
…. Process rows ….

I've used the SKIP option for CSV and XLSX however I don't know if it will let me skip the first 2 rows of the header. As a fallback, I could always just create a copy of the spreadsheet and eliminate the first 2 rows in the header. That might actually be the simplest option at this point.

SKIP with LOAD CVS does work. I just verified, but the header row still has to be the first row though. As such, it will not work in your case.

I have not verified, but I would imagine the APOC LOAD CSV may similar behavior.

Can you use column indexes instead of headers? If so, skip the first three rows and refer to each column as row[0], row[1], etc.

LOAD CSV from "file name" as row
With row
Skip 3
return row[0], row[1]...