Trouble with importing excel (csv) to MySQL

Hey. I am trying to import a file to my MySQL database. I have downloaded an excel-file and then corrected it, so it fits properly with my table, I would think (i am still pretty new to MySQL so I followed a couple guides). I saved the excel-file as a .csv and went to phpMyAdmin and chose "Import". But it gives me this error
"Invalid field count in CSV input on line 1."
I have no idea what is wrong. It looks pretty much right in my opinion
Please help me!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MisterHamperAuthor Commented:
In the picture is my table. It has an id with autoincrement

And in the code snippet is the start of my excel.csv file. I also tried deleting the first line, and importing it, but the same error came up!
,"BUTTER,WITH SALT","1 cup",227,"1 tbsp","14,2",717,"81,11","51,37",0,"0,85",215,576
,"BUTTER,WHIPPED,WITH SALT","1 cup",151,"1 tbsp","9,4",717,"81,11","50,49",0,"0,85",219,827
,"BUTTER OIL,ANHYDROUS","1 cup",205,"1 tbsp","12,8",876,"99,48","61,92",0,"0,28",256,2
,"CHEESE,BLUE","1 oz","28,35","1 cubic inch","17,3",353,"28,74","18,67",0,"21,4",75,1395
,"CHEESE,BRICK","1 cup, diced",132,"1 cup, shredded",113,371,"29,68","18,76",0,"23,24",94,560
,"CHEESE,BRIE","1 cup, melted",240,"1 cup, sliced",144,334,"27,68","17,41",0,"20,75",100,629
,"CHEESE,CAMEMBERT","1 cup",246,"1 oz","28,35",300,"24,26","15,26",0,"19,8",72,842

Open in new window

theGhost_k8Database ConsultantCommented:
Its a not-null autoincrement field.
Try allowing null.
MisterHamperAuthor Commented:
Hey! I just tried changing id to null - but it just reverts back to "null: no" again right after.
It says this when I change id to null, but still it is still "null: no". It's strange
"Table foodcomp has been altered.
SQL query:
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

theGhost_k8Database ConsultantCommented:
Your number of fields are different in CSV and in your  table structure,
theGhost_k8Database ConsultantCommented:
You're missing "carbohydrates" field  and that is causing problem as its not matching the number of columns in table.
MisterHamperAuthor Commented:
Ahh yes you was right! Good observation. I just removed "carbohydrates" from my table, so now they should look the same both of them.

But it still gave me this error: Invalid field count in CSV input on line 1.
I think it might have something to do with "id". Is "id" written correctly in my excel.csv file for it to auto-increment, because I am not sure at all?
theGhost_k8Database ConsultantCommented:
I've observed that if you don't give newline at end of the file it will give "Invalid format of CSV input on ..."
Remove field-names from line 1 and also add new line at the end of file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
theGhost_k8Database ConsultantCommented:
Optionally you can give :
Number of records(queries) to skip from start  = 1
theGhost_k8Database ConsultantCommented:
I hope your providing proper options while importing csv file:
Fields terminated by = , instead of default "
MisterHamperAuthor Commented:
Ahh yes it seems it is working now. I tried skipping 1 line, and remembered to use "Fields terminated by = , "

Thanks alot, my good sir! :D Have a nice day
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.