Invalid column count in CSV input on line 1 when trying to import records into a table - mysql

I'm trying to import some records into a table in my database. The table already has data.
I've checked similar issues here and tried al recommended solution but I'm still getting the error.
Here is a screenshot of my phpmyadmin:
In my csv file I have removed the header and also replaced semi-colons with commas.
These are my column names:
name,last_name,role_id,username,email,street,apartment_etc,city,state,country,zip_code,email_verified_at,password,profile_image,company_name,created_at
and here is an example record I'm trying to import:
NULL,NULL,3,NULL,s8888888#gmail.com,NULL,NULL,NULL,BU,HU,NULL,2022.03.14 18:57,$2y$10$yyqbgtc1WFpgWz8ofH70ieDu2fdISEnSDvN5d/Y14hMK3osUNUlmC,default-user-avatar.png,NULL,2021.06.03 11:24
Maybe the problem is that the table already has records in it?

Related

Unable to import csv file due to duplicate id in file

I have a csv to import to mysql which I have created a table for and am using Table Import Wizard to import the data into this created table.
However, I met with this error of stating that it has duplicate entries in the id column.
The duplicate ids are actually coupled with different days of info. How can I successfully import this into my created table please?
I tried to indicate that this is Unique when creating the table, also tried if it is not Unique.
Snapshot of my csv file

When I import a CSV to MySQL Workbench two extra columns appears

I have a CSV file with 9 columns but when I import it via MySQL Workbench it appears two extra columns with no values. A kind of solution is to deselect them but I want an explanation and a permanent solution to avoid this. Why is this happening? I attach a screenshot to see exactly what I say.
Sometimes in excel file type something and delete, excel file include or read blank columns or row.
If you delete those two columns after gameid in CSV file, after that import CSV file in mysql.

Cant update the csv table into phpmyadmin

I get an error which uploading the csv file having different number of "filled" columns as compared to number of column titles in the database
error is this:
Invalid column count in CSV input on line 1.
When i try to import it with the headings (titles of columns), it works. Else it doesnt work at all.
I dont want to add columns while importing as i am just updating the chosen values of the columns.
I want to update the table now and then.

Invalid field count in CSV input on line 1 phpmyadmin

I have read many threads but can't find the right specific answer. I get this error message when I try to import additional data into an existing table. The field names are all aligned correctly, but not every row has data in every field. For example, although I have a field named middle_name, not every row has a middle name in it. During the import process, is this blank field not counted as a field and thus throwing off the field count?
I have managed to get most of the data to import by making sure I had a blank column to allow for the auto-increment of ID, as well as leaving the header row in the file but choosing 1 row to skip on the import.
Now the problem is the last row won't import - get error message Invalid format of CSV input on line 19. When I copy the file to Text Wrangler, the last row ends with ,,,,,. This accounts for the last 5 columns which are blank. I need to know what the trick is to get the last row to import.
Here are the settings I have been using:
I’ve had similar problems (with a tab-separated file) after upgrading from an ancient version of phpMyAdmin. The following points might be helpful:
phpMyAdmin must have he correct number of columns. In older versions of phpMyAdmin you could get away with not supplying empty values for columns at the end of the row, but this is no longer the case.
If you export an Excel file to text and columns at the start or end of rows are completely empty, Excel will not export blanks for those rows. You need to put something in, or leave blank then edit the resulting file in a text editor with regular expressions, e.g. to add a blank first row, search for ^ and replace with , (CSV file) or \t (tab file); to add two columns to the end search for $ and replace with ,, or \t\t etc.
Add a blank line to the bottom of the file to avoid the error message referring to the last line of data. This seems to be a bug that has been fixed in newer versions.
Whilst in the text editor, also check the file encoding as Excel sometimes saves as things like UTF-16 with BOM which phpMyAdmin doesn’t like.
I saw the same error while trying to import a csv file with 20,000 rows into a custom table in Drupal 7 using phpmyadmin. My csv file didn't have headers and had one column with many blanks in it.
What worked for me: I copied the data from Excel into Notepad (a Windows plain text editor) and then back into a new Excel spreadsheet and re-saved it as a csv. I didn't have to add headers and left the blank rows blank. All went fine after I did that.
You'll never have this problem if you keep your 1st row the header row, even if your table already has a header. You can delete the extra header row later.
Why this helps is that, then mysql knows how many cells can possibly contain data, and you wont have to fill in dummy data or edit the csv or any of those things.
I’ve had a similar problem, Then I have tried in Mysql Workbench.
table data import through CSV file easily and I have done my work perfectly in MySQL Workbench.
As long as the CSV file you're importing has the proper number of empty columns, it should be no problem for phpMyAdmin (and that looks like it's probably okay based on the group of commas you pasted from your last line).
How was the CSV file generated? Can you open it in a spreadsheet program to verify the line count of row 19?
Is the file exceptionally large? (At 19 rows, I can't imagine it is, but if so you could be hitting PHP resource limits causing early termination of the phpMyAdmin import).
Make sure you are trying to import the table into the database and not the database > table.
I had this same issue, tried all listed and finally realized I needed to go up a level to the database

MS Access 2007: How can a csv file and its csv data be imported to a mdb table which has only column headings?

Where the column headings are in the db and matched up with the file's csv columns.
I get 2 error message popups at the end of the importer wizard:
1) squash the existing table 'table_name' and a yes/no selection. I select 'yes', then
2) "impossible to replace the table 'table_name' "
The CSV file matches with the table in column number, it only contains the data to fill the rows, it does not contain the headings.
Problem solved using excel.
Sorry, I'll try to think about what I'm really looking to do before posting next time - I really just wanted to match up the data from the CSV file to the headings from the Access table. I was able to import both into excel to match them up, thanks to those who tried to help.