kiat has asked for the wisdom of the Perl Monks concerning the following question:
I've data in an Excel format and I would like to feed that data to mysql. I just discovered Spreadsheet::ParseExcel and found it to be really cool.
What I intend to do is to parse the excel file using ParseExcel and then have the perl script write the necessary sql statements into a source file. For instance, let's say I've two rows of data from Excel as follows:
The output from the perl script (using ParseExcel) will be saved to a insert source file and it will look something like:id joke created owner 1 joke one 2004-04-12 john 2 joke two 2004-04-11 nick
I will then use mysql command 'source name_of_file' to insert the data into a table.INSERT INTO JOKES VALUES('1', 'joke one', '2004-04-12', 'john'); INSERT INTO JOKES VALUES('2', 'joke two', '2004-04-11', 'nick');
I suppose I could have the script connect to the database and directly insert the data to the relevant table, thereby bypassing the step to create a mysql source file.
Am I on the right track? Is there perhaps a more direct conversion path from Excel to mysql?
Cheers and many thanks in advance :)
Update: Great thanks to all for your solutions and ideas!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: From excel to mysql...
by tachyon (Chancellor) on Apr 13, 2004 at 14:51 UTC | |
by kiat (Vicar) on Apr 13, 2004 at 15:03 UTC | |
by tachyon (Chancellor) on Apr 13, 2004 at 15:13 UTC | |
by disciple (Pilgrim) on Apr 13, 2004 at 18:51 UTC | |
by kiat (Vicar) on Apr 13, 2004 at 15:36 UTC | |
by diotalevi (Canon) on Apr 13, 2004 at 15:20 UTC | |
by tachyon (Chancellor) on Apr 13, 2004 at 15:29 UTC | |
by jmcnamara (Monsignor) on Apr 13, 2004 at 19:39 UTC | |
by diotalevi (Canon) on Apr 13, 2004 at 16:49 UTC | |
by Zaxo (Archbishop) on Apr 14, 2004 at 08:09 UTC | |
|
Re: From excel to mysql...
by dragonchild (Archbishop) on Apr 13, 2004 at 14:44 UTC | |
|
Re: From excel to mysql...
by diotalevi (Canon) on Apr 13, 2004 at 14:45 UTC | |
by kiat (Vicar) on Apr 13, 2004 at 15:54 UTC | |
|
Re: From excel to mysql...
by jZed (Prior) on Apr 13, 2004 at 14:54 UTC | |
|
Re: From excel to mysql...
by Anonymous Monk on Jun 08, 2017 at 08:31 UTC | |
|
Re: From excel to mysql...
by Anonymous Monk on Jun 08, 2017 at 08:33 UTC | |
by Corion (Patriarch) on Jun 08, 2017 at 08:39 UTC | |
by Anonymous Monk on Jun 08, 2017 at 11:56 UTC | |
by marto (Cardinal) on Jun 08, 2017 at 12:27 UTC |