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!
In reply to From excel to mysql... by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |