MySQL Forums
Forum List  »  CSV Storage Engine

Uploading CSV
Posted by: Peter Richards
Date: June 21, 2018 10:16PM

Sorry if this is a very basic question, but ....

I'm in the process of setting up a MySQL database and have a one line test entry.

When the database is running live I need to be able to sort by one of the columns (surname) so have been trying to see how I may do this.

I can export the database as a CSV file, which is then opened in a spreadsheet (Open Office Calc) where it may be sorted.

However, I am unable to import it back again as whatever I try I have the error message:

Invalid column count in CSV input on line 1.

Yet I have ten columns in both MySQL and the CSV file

The columns look like this:

"id" "username" "firstname" "surname" "password" "email" "active" "code" "role" "avatar"


When I export the file into OO Calc I use the | to separate the fields. I know I have to edit this out if uploading to a flat database, but what should I be doing to successfully import the CSV file into MySQL please? At present I have been changing the "Columns separated with:" field from a comma to the | separator and I've tried entering:

id,username,firstname,surname,password,email,active,code,role,avatar

in the Column names field, but it made no difference.

Options: ReplyQuote


Subject
Views
Written By
Posted
Uploading CSV
660
June 21, 2018 10:16PM
359
June 22, 2018 07:56AM
438
June 22, 2018 10:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.