I've found that a csv file with newlines in any fields will cause an incorrect import. As in, there will be an incorrect number of final fields for each "row" that is called by fgets, as well as each row with a newline in one of it's fields having incorrect starting and stopping points for it's fields after the newline field. I saw the code there that should make this work and add the next line to the string operated on for the row, but it doesn't work.

I hacked node_import.module to make this work for my project. I have scraped about 10,000 webpages to import into drupal as nodes, so this is imperative to me to make it work correctly.

Attaching my patch...

CommentFileSizeAuthor
node_import.module.patch1.81 KBjbizzay

Comments

sutharsan’s picture

Category: support » bug
Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

I ran into the same situation. The patch works like a charm!
Changing the priority, this patch is a must!

joachim’s picture

+1
Same problem, patch works perfectly. Thanks for your work -- saved me a big headache!

Could the maintainer please commit & make a new release please?

zach harkey’s picture

HALLELUJAH !!!

Thank you jasonalank!

+1

Tested. Works. This patch is critical.

elly’s picture

Hiya - I have a CSV file with line breaks and this patch isn't really working for me. Does anyone have any tips or tricks? I'm trying to import my old blog so I have lots of body fields with newlines. Node import seems to be reading each chunk of text between a newline as its own item. I don't get why this patch isn't working!

Robrecht Jacques’s picture

Status: Reviewed & tested by the community » Fixed

Fixed. Will be included in next release of node_import (5.x-1.7) released later today.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

myudkowsky’s picture

Version: 5.x-1.6 » 5.x-1.9

Although the patch is present in 5.x-1.9, import of a file with newlines does not work: #351009: Multi-line Import Fails (csv contains newlines).

For example, using the module's test/node.csv, each line of the multi-line body is treated as the start of a new record.