Saturday, August 3, 2013

How to import Excel sheet to MYSQL

1. This is my Excel sheet with one table.


2. Save the Excel sheet in .csv format.

3.Open the saved file with a text editor.


4.You can see rows are separated in new lines and columns separated with commas.

5. Create mysql database and create a table with same number of columns as the Excel table.In my example, my sql table fields are username,password and type.

6.Execute this query 

LOAD DATA LOCAL INFILE 'C:\\Users\\Monto\\Documents\\Book1.csv' INTO TABLE alumini.login FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (usrename, password,type);  

7. The result 






No comments:

Post a Comment