-1

CSV file data

database structure

mysql error

data stored

I tried multiple times uploading the data in MySQL database. but still getting the same error and I found multiple solutions for this but I am still getting this issue

invalid column count in CSV input on line 2.

How can I upload CSV file in MySQL database? Plz help me.

  • Welcome to StackOverflow. Please [take the tour](https://stackoverflow.com/tour) an read [What topics can I ask about](https://stackoverflow.com/help/on-topic) and [What topics to avoid](https://stackoverflow.com/help/dont-ask) and [How to ask a good question](https://stackoverflow.com/help/how-to-ask) and [the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and how to create a [Minimal, Complete and Verifiable Example](https://stackoverflow.com/help/mcve). – common sense Nov 28 '18 at 10:40
  • 1
    code and data is text, not pictures. Please add it as text, not pictures. Then it's searchable, copyable, usable for trying to reproduce your issue. Thanks. – ADyson Nov 28 '18 at 10:43
  • How was the upload done? Via `LOAD DATA`? If so, let's see the entire text of the command. – Rick James Nov 29 '18 at 00:15
  • Some of the errors come from the backslashes in the csv file. I _guess_ that that file is in some strange format. See if you can get a hex dump of the first couple of lines. – Rick James Nov 29 '18 at 00:17

1 Answers1

0
  1. save the .xlsx or xls to CSV (comma delimited) (*.csv) and save .xlsx to Unicode Text (.txt)
  2. Then open .txt file in Notepad
  3. Select and copy the space, replace it with comma
  4. Save the .txt file, by replacing the CSV file in UTF-8 format.
  5. then try to upload this UTF-8 .csv in database table.

It worked for me, hope so it will work for you too.