phpmyadmin error: Invalid column count in CSV input

This subforum is for issues specific to importing or maintaining product databases, e.g. using phpMyAdmin.

phpmyadmin error: Invalid column count in CSV input

Postby support » Wed Mar 28, 2012 1:35 pm

Receiving phpMyAdmin error on import of CSV file:
Invalid column count in CSV input on line 1.

older phpMyAdmin versions showed:
Invalid field count in CSV input on line 1.

That error just means that the number of columns you listed in Step 9 (of the "Brief step-by-step" import instructions on the wiki) does not equal the number of columns in your CSV file. Make sure there is not an empty column(s) at the end, which would look like two or more commas (",,").
support
 
Posts: 566
Joined: Sun Mar 11, 2012 9:06 am

Re: phpmyadmin error: invalid field count

Postby support » Sun Apr 22, 2012 9:44 am

Another possible cause of this "invalid field count in CSV input on line 1" error is that the file you are importing is not actually CSV format. The filename might end in ".CSV" but could actually be a different format, usually Excel binary / XLS format.

The fix is to "Save As" and change format to CSV, in your Spreadsheet application (Excel, OpenOffice Calc, Numbers, etc). Upload the new file you just saved in actual CSV format.
support
 
Posts: 566
Joined: Sun Mar 11, 2012 9:06 am

Re: phpmyadmin error: invalid field count

Postby support » Sat Nov 03, 2012 11:34 am

Another possible cause of the "invalid field count" error, though probably not on line 1, e.g.
Invalid field count in CSV input on line 250.

is an improperly escaped field separator embedded within a field. One common occurrence is you have a double-double-quote ("") inside one of your fields. Spreadsheets sometimes export a CSV file this way, by escaping a " with another ". So a line might look like:
Nuts & Nut Butter,N270,"Chocolate Hazelnut Butter (""Betony Butter"") *LOCAL* – Case of 12 X 1lb jars",Oregon,,OG ,12.00 lbs,91.2,3

Normally (phpmyadmin import default) the field separator is double-quote ("), and the escape character is backslash (\). So to fix this, you need to change the "" to \":
Nuts & Nut Butter,N270,"Chocolate Hazelnut Butter (\"Betony Butter\") *LOCAL* – Case of 12 X 1lb jars",Oregon,,OG ,12.00 lbs,91.2,3
support
 
Posts: 566
Joined: Sun Mar 11, 2012 9:06 am

Re: phpmyadmin error: Invalid column count in CSV input

Postby lindah » Sat Mar 05, 2022 10:53 am

so, I'm having this problem (in excel files saved as CSV DOS)... repeatedly with different files for different sources... how do I find the hidden quotes ("")?
I've done a search with "find" and it comes up as not found.
I've tried save as and selecting the CSV option, but it's not working
lindah
 
Posts: 3
Joined: Sun Nov 08, 2015 6:02 pm

Re: phpmyadmin error: Invalid column count in CSV input

Postby support » Thu Apr 21, 2022 10:51 am

If you can't find the double quotes "" with a search in a text editor, then that's not the cause of your error. There are multiple possible causes of this error - that is just one of many.
support
 
Posts: 566
Joined: Sun Mar 11, 2012 9:06 am


Return to Product database

Who is online

Users browsing this forum: No registered users and 1 guest

cron