Anuj Mittal
Anuj Mittal

Reputation: 5

Excel file to mysql

I am creating a web application to collect some specific data from users. What I want is that the user uploads an excel file containing the data on the web page I created and that excel file stores its data on MySQL database. Is it possible?How?

Upvotes: 0

Views: 43

Answers (1)

Cyberlurk
Cyberlurk

Reputation: 764

It's possible.

I would convert the Excel file to a csv file, or make the user upload a csv file instead. Excel already has this feature build in.

Then in MySQL you can turn the csv file into a tmp table with ease:

LOAD DATA LOW_PRIORITY LOCAL INFILE 'C:\\Users\\Desktop\\nameoffile.csv' REPLACE INTO TABLE `tmp_table` CHARACTER SET latin1 FIELDS TERMINATED BY ';' LINES TERMINATED BY '\r\n'; 

After that you transfer your data from the tmp table into the tables you'd like and finally you delete the temporary table.

Upvotes: 1

Related Questions