Import CSV with commas in row values

I want to follow up on this.

I have an Excel-spreadsheet with sentences with both comma (,) and quotation marks (").

When choosing save as CSV in Excel, there are different types of CSV, some of them not even seperated with commas, but rather with semicolons or tabulator.

I choose the one that says "kommasepareret" (comma seperated), partly because it also allows for UTC-8 which is handy when using æøåé and other symbols.

The spreadsheet i am exporting as CSV does only have one column and therefore no fieldterminator

My solution was neither to put quotation marks around the lines, nor to escape the commas or quotation marks. instead in just filled the second column with the same word: "STINKYWINKY" and exported to CSV

This gave me this spreadsheet

and when opened in notepad it looks like this

Which, as you can see, added SEMICOLON as fieldterminator and then my magic word.

The i simply ran this query:

LOAD CSV FROM 'file:///emner.csv' AS line FIELDTERMINATOR ';'
CREATE (:SENTENCE { name: line[0]})

and then it worked.

1 Like