-3

I've seen a lot of questions here about how to export a sql database to excel, but I have a ton of information from an excel file that I would like to export to sql database. The file is extensive and it could take me years to transfer the info manually... years! Is there a faster easier way to do this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
JoeyFur62
  • 267
  • 4
  • 6

8 Answers8

2

You don't actually need to write code to do this.

Save the Excel file to CSV format and then see one of the many related questions:

The friendliest way is to use a graphical tool like HeidiSQL to match up the excel columns to the columns in your database.

HeidiSQL

Community
  • 1
  • 1
Colin Pickard
  • 45,724
  • 13
  • 98
  • 148
0

You can use apache poi library to read the excel file line by line and jdbc to create connection to mysql database and execute insert statements.

In my project I used jruby with nurettin-jruby-poi fork of the jruby-poi gem to read the excel file and activerecord to insert the data into mysql.

nurettin
  • 11,090
  • 5
  • 65
  • 85
0
  1. Write a .NET Program (Console is simpler)
  2. Access the Excel Worksheet/Workbook
  3. Copy the Attributes and create appropriate Tables for the sheets in your Excel
  4. Now copy the contents to SQL Tables appropriately

Since it is automated it will be faster

Rahul Reddy
  • 128
  • 10
0

As Colin Pickard said, you can use CSV format that can be directly imported.

If you're using PHP, you can use the PHPExcel library here which can do the job !
Btw, you should tell us if you're using a certain language..

Val
  • 762
  • 8
  • 32
0

You can use a GUI Data Import tool, it supports direct import from *.XLS and *.XLSX (Excel 2007) files.

Devart
  • 119,203
  • 23
  • 166
  • 186
0

Use Talend Open Studio to visually design and then automate any kind of data integration job.

http://www.talend.com/index.php

Laszlo T
  • 1,165
  • 10
  • 22
0

My favorite tool for converting excel sheets into mysql database... Full disclosure, I am the author.

panofish
  • 7,578
  • 13
  • 55
  • 96
0

creating a CSV is better. if we use CSV method we can export any character sets(unicode) also ones we create a CSV file then, just use LOAD method available in mySql. load method is used to import data to mysql directly(using sql query). LOAD local permit you to import data from any location in your local machine