Skip to main content

Drupal 7: Feeds Import: Generating the correct .csv

Today I needed to import about 2000 user accounts into a new Drupal 7 database. To do this I decided to use the Feeds module which includes a Feeds Import module. Perfect! First, I went to the feeds admin interface and setup the import by mapping all of my fields to the .csv. Next, I opened Excel and generated my spreadsheet. Once that was completed I saved the spreadsheet as a .csv file and tried to import. The form returned with the following message "0 users created". WTF! I double checked the spreadsheet and resaved as a new .csv file and tried again. Still nothing happened! Grrr...

After a moment of thought it dawned on me that Excel was probably encoding the file wrong. I opened the .csv Excel saved with TextWrangler and resaved the file and set the file encoding to UTF-8 and saved the line breaks as the Unix format instead of OS X. Next I re-imported the new .csv file and everything worked perfectly.

Lessons learned

- Don't send a Microsoft program to do a man's job.
- Always import a .csv file in Unix format and UTF-8 encoding.