Daniel H
Daniel H

Reputation: 2925

Importing a specific column into phpmyadmin database

I have been given an excel document which contains information about different embassies, their contact numbers etc. Most of this information is in the database already, but I need to extract one column from this file (emails) and insert it into a specific column (emails) in the database.

Is this possible, or can you only import an exact copy of what you want in the database?

Thanks for any help

Upvotes: 4

Views: 6715

Answers (2)

Tim Joyce
Tim Joyce

Reputation: 4517

Export the table from phpmyadmin as CSV for excel - 
drag it into excel - 
add the desired column - 
Save - 
export the table again from phpmyadmin as .sql - 
copy the table creation(Not the data) - 
delete the table from phpmyadmin- 
Run the table creation query so you now have a blank table - 
Import the excel csv.

IMPORTANT: backup your database

Upvotes: 4

Piskvor left the building
Piskvor left the building

Reputation: 92772

You may want to make a script with php-excel-reader which goes throught every row in the file, and updates the corresponding database row. I don't think that you can import a file "selectively" in phpMyAdmin.

Upvotes: 2

Related Questions