Excel on Mac saves things with Mac newlines when you actually want Unix ones. Uploading a CSV file from it results in "0 things found". It took me an amazingly long time to figure out how convert the newlines (note to future self: cat filename.csv | tr '\r' '\n' > new-filename.csv) to something Feeds module would parse.

Comments

chrisjlee’s picture

@webchick Can you provide an example file to test with? forgive me I don't have excel on mac but this problem raises my curiosity.

p.s. you should try sed for the time being it's a little easier:

$ `sed -e 's/\r/\n/g' filename.csv`

wusel’s picture

Like I wrote at http://drupal.org/node/622710 - "CSV":

The line-ending-char(s) of a Feeds-imported CSV-file depend on the type of the operating system of the www-server:
If you are using a Linux-Server, please use only "LF" at the line-end of the CSV-file.
If you are using a Windows-Server, please use "CR+LF" at the line-end of the CSV-file.
If you are using a Mac-Server, please use only "CR" at the line-end of the CSV-file.
The changing of the line-end of the CSV-file is important, if the source of the CSV-file (e.g. your computer or the database of the CSV-file) has a different operating system!

It would be fine, if drupal would convert the line-endings as needed.

But the same problem is with all files from other operating systems like ".patch"-files to patch Drupal and with imported CSV-Files for the module Migrate.

rickmanelius’s picture

PHP_EOL could be used to detect the OS's end line format. And opening the file and running a count on each end line type would help us detect the most likely end line format for the file. Then we could create a series of regular expressions to convert the files detected end line's into an OS friendly version and call it a day.

A relevant link on the usage of PHP_EOL.
http://stackoverflow.com/questions/623776/does-php-have-a-function-to-de...

timcosgrove’s picture

Subscribe. Banged my head against a wall on this for 45 minutes or so.

rickmanelius’s picture

FYI, I've tried the http://drupal.org/project/feeds_xls module and it worked without a hitch on my first import with a styled XLS file. For anyone else struggling with the CSV endline issue, this might be a path forward.

bluegeek9’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.