Archive for March, 2012

Importing CSV data from Excel into phpMyAdmin

March 7th, 2012

When importing CSV data saved from Excel into a MySQL database using phpMyAdmin, I was getting an error indicating that there was an “Invalid field count in csv input on line 1″. The settings in phpMyAdmin asked for fields to be delimited by double quotes (“field”) but even after doing that I was still getting the same error message.

In order to get the input to work, I resaved the Excel file as a CSV (and didn’t place quotes around the columns) then removed the first row containing the field titles. In phpMyAdmin I then chose the following settings:

Format: CSV using LOAD DATA
Columns terminated by ,  (not the default of ; )

All other settings were left at their default.

I was then able to successfully import the CSV file.