Zero
Zero

Reputation: 76917

Import excel workbook to Mysql database

Is there a way by which I can import an excel workbook which has multiple sheets to mysql database into multiple tables?

Which means, lets say

I have an excel workbook with 3 sheets named sheet1, sheet2 sheet3. Headers for each sheet is on the first row. Now I need these 3 sheets to be stored as 3 tables (sheet, sheet2, sheet3) in the database.

Is there a way to do this using phpmyadmin, php, python or any other?

I know, we can import individual csv sheets. I want to know if batch import works or not

Upvotes: 0

Views: 3130

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174624

Is there a way by which I can import an excel workbook which has multiple sheets to mysql database into multiple tables?

If you have remote access to the database or if the database is on the same machine where you have Excel; the easiest way is the MySQL for Excel addin which allows you direct access to MySQL from within Excel.

If not, you have other options:

  1. Export each sheet as a csv file, and then read those files individually to create the tables and populate them. Other than the Excel addin option, this is the recommended.

  2. Use xlrt or phpexcel to read the native .xls format files and extract the information required from each sheet. This would be closest to your batch import requirement; in that you don't have to deal with multiple files representing each sheet.

Upvotes: 2

Related Questions