I do it all of the time, and once you get the hang of it this is quite easy.

The simple-minded way is to generate one SQL statement per row of the
original spreadsheet (assuming that each row of the spreadsheet corresponds
to a row in the data base table).

1.      Create a new worksheet, if needed. Position yourself at cell A1.

2.      Using Excel functions, build an entry like

        =CONCATENATE("INSERT INTO mytable SET col1 = ",'Sheet1'!A1,", col2 =
",'Sheet1'!A2, ...)

        You can use Excel's click to build the cell links to the other
spreadsheet, you don't have to type them by hand.

3.      Copy the formula down the range you need.

4.      Save the worksheet containing the MySQL commands as a text file.

5.      From the mysql command line interface, simply USE the right data
base and then source the text file you created. Alternatively, you can
insert the USE statement into your spreadsheet (adjusting the row numbers
accordingly) or directly into your text file, and redirect the input file
for mysql on the command line.

Once you get the hang of it, this is all simpler than it sounds.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341


> -----Original Message-----
> From: Roberto William Aranda-W Roman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 18, 2006 8:37 AM
> To: MySQL List
> Subject: excel and Mysql?!
>
>
> hello .
>
> anybody knows how to export from excel to mysql in order to
> create or fill a database table??
>
> tanks for your help and patience
>
> cheers
>




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to