Microsoft Excel is used for data entry in a lot of places, and moving data from Excel into a MySQL table (where a database server can put the information out on the web or make it available for other applications) is a common data transfer task. Fortunately, it's straightforward.
Instructions
- 1
Open the Excel file with the data you want to transfer to MySQL.
2Ensure that the data headers and columns are in the right places to correspond with the fields of the MySQL table you intend to populate.
3Click on the "Office" button in Excel 2007, or click on the "File" menu item in Excel 2003 or earlier.
4Select "Save As."
5Select "Comma Separated Values" for the file format, and save the file in a directory that your MySQL server can access.
6Log into your MySQL server, and launch the MySQL access panel. Implementations differ and configuration values differ from server to server; if you do not know how to launch the MySQL tools on your server, consult with your server administrator.
7Type the following commands into MySQL, without the quotes. Be sure to replace "Filename" with the name of your actual file. Hit the "Return" key after each command:
"load data local infile 'Filename.csv' into table tblFilename"
"fields terminated by ','"
"enclosed by '"' "
"lines terminated by '\n'"
0 comments:
Post a Comment