phpmyadmin - Unable to import spreadsheet "#1005 - Can't create table `database_name`.`table_name` (errno: 185 "Too many columns")" - mysql

I am trying to import a spreadsheet into my database but I am running into the following error:
Unable to import spreadsheet "#1005 - Can't create table database_name.table_name (errno: 185 "Too many columns")"
I looked this error up and my spreadsheet is well below the maximum column count of mysql (it only has 7) so I am not sure why I am experiencing this error. I thought maybe it had to do with some formulas I had on the table so I copied the cells data to another column, then copied those values back to the original column and I am still having the same error. I am importing the spreadsheet as a .ods file.
Update 1: I converted my spreadsheet from .ods to .csv and I was able to now import my data without any issues. While my problem is now fixed I would still like to know how to fix the original problem I was having without having to convert the file type.

Related

Error when importing .csv into MySQL DB using My SQL Workbench Table Import Wizard

I'm in the beginning stages of trying to move some data from Google Sheets into a MySQL DB. I'm starting with one sheet that contains some user data. I save the sheet as a csv, then select that csv through MySQL Workbench's Table Import Wizard.
When I do, I receive the following error:
Unhandled exception: 'ascii' codec can't decode byte 0xc3 in position
178: ordinal not in range(128)
Some initial troubleshooting has revealed to me that I think the problem is a character in a name - a french user with the first name Aimée. Based on the error message, I've been trying to convert the google sheet data to utf-8 (as opposed to ASCII) before downloading as a csv, but everything I'm reading seems to say that simply downloading as a .csv should solve the problem.
Steps to reproduce:
download Google Sheet as .csv
Open MySQL Workbench and select existing table
Select Table Data Import Wizard
When prompted, select the .csv file I've just saved as the source file
Select my existing table in the MySQL db as the destination table
Click "Next", and receive error.
There may be two errors here. Assuming you wanted an "acute-e", what you got was the utf8 encoding for such, hex C3A9. Then, because something was expecting ascii, it complained about the C3.
If you have an existing MySQL table, check the column's character set by doing SHOW CREATE TABLE. If the column does not have the charset, then the table's DEFAULT CHARACTER SET will take over. I suspect one of those is "ascii".
Change that to utf8mb4.
This may come in handy if you have further troubles: Trouble with UTF-8 characters; what I see is not what I stored

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

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?

Importing partial data into MySQL from CSV

I have a CSV that is a partial projection of an origin table. I have the same table structure in my DB.
I would like to import only those columns into my DB, given that no additional NOT NULL constraints are in place (I explicitly disabled some of them). I don't know how to import them.
I have tried the following: from MySQL Workbench, right click on table and then Edit table data, then on the screen I tried the "Import records from an external file" button, loaded the CSV file but I got the following error:
[Window Title]
MySQL Workbench
[Main Instruction]
Error importing recordset
[Content]
error calling Python module function SQLIDEUtils.importRecordsetDataFromFile
[OK]
The column names are the same as in the DB but these are partial (not all columns as DB). The table is currently empty.
What can I do to import the data into MySQL?
It turns out that is the error that tool gives for ANY problems importing CSV data. They have opened a bug for more descriptive error responses.
For me it turned out that it can not work with non-Windows line breaks. So if your file came from Unix/Linux or Mac it will not work. You can just open it in Excel though and re-save it as an MS-DOS CSV and then it works. Other things that can make it throw up are any use of ";".
Also the tool has NO column mapping options so you have to have your import file matched to the table setup perfectly. If you have columns mis-matched or data types mis-matched it will also throw-up.
I got the same question and error when I was importing a csv file into MAC Mysqlworkbench.
I restored my file as windows comma separated (.csv). This works for me.
Check do you have permissions to import (on insert), and if you import clearing old data check do you have permissions on delete.
If it won't help, create a new table with least restrictions which has absolutely identical columns as in CSV file, try to import to it. If ok - just update/insert into your target table
If it won't help, try to import on another database.
If it won't help, check CSV file - is all contents is ok? (may be it should try first)

Does phpmyadmin have a function like access to split one tabe into multiple tables?

I have an Excel spreedsheet with all my info saved in it. From the spreadsheet I save it as 2 CSV documents. The reason for saving it as 2 documents is because my host refuses to increase the upload size in phpmyadmin. I upload the documents into a table and use it from there. But this is not the correct way to use a database. If I import my Excel spreadsheet into MS Access there is a function that I can Split the table into multiple tables that have relations and ID's so that everything is only saved once linked very nicely. The function in Access is called 'Analyze Table' but the analyze table in phpmyadmin clearly isn't the same.
I have tried to build my own databse in excel and then export it to phpmyadmin but when trying to import data into my main table with all the relations it spits this message back to me 'Cannot add or update a child row: a foreign key constraint fails'.
What is the best way to import a large spreedsheet into phpmyadmin so it works like a proper database?
Please help as I'm at a dead end
Many Thanks

MS Access Import Error Table

When importing data into an MS Access Database, sometimes there are errors in the formatting of the data source.
As I recall, when this happens, MS Access will put the offending row into a separate table called <something>.
What is this table's proper name?
Import Errors is the name of the table, followed by an integer if you have had previous failed imports. (Access 2003: http://office.microsoft.com/en-us/access-help/import-or-link-data-and-objects-HP005187610.aspx?CTT=1)
Access will create a table called Paste Errors for pasted data.
I notice that in Access 2010, the file is called <name of import file>_ImportErrors, for example, importing try.txt would give try_ImportErrors:
Error Field Row
Null value in an auto-number field id 2