Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert excel file into mysql database? [duplicate]

Tags:

php

mysql

excel

my boss wants me to create a mysql database for an existing excel file. I was wondering if there are any ways to do convert or import excel file? I have searched google but didn't find anything useful. I appreciate for any reply....Thanks.

like image 763
FlyingCat Avatar asked Sep 01 '10 20:09

FlyingCat


People also ask

Can Excel Write to MySQL database?

The MySQL Excel Add-In is a powerful tool that allows you to connect with live data from MySQL Server databases, directly from Microsoft Excel. Use Excel to read, write, and update MySQL data.


3 Answers

  1. Save as CSV
  2. Use a COPY sql statement
  3. Profit
like image 143
Chris J Avatar answered Oct 12 '22 00:10

Chris J


If you have a web server up and running with PHP support, I highly recommend phpMyAdmin.

  1. Configure it to connect to MySQL
  2. Create the Database and table
  3. Click the import tab and you can import a CSV.

If this is a simple one-time import this probably isn't worth the effort. If, on the other hand, you will ever have to work with MySQL again, you will never regret the time to install and configure phpMyAdmin.

like image 4
Icode4food Avatar answered Oct 12 '22 00:10

Icode4food


PHPMyAdmin can import CSV files, as well as Excel files (though I've never tried it)

First you need to create your datebase, and add a table. There must be as many fields in that table as there are columns in your Excel document (yes, I know you know)

Then select that database and table in phpmyadmin and use the "Import" tab.

like image 4
Yanick Rochon Avatar answered Oct 12 '22 00:10

Yanick Rochon