I've problems binding the values from the parsed Excel file to the DBI execute command. How exactly do I bind those values?
cheers,use strict; use Spreadsheet::ParseExcel; use Data::Dumper; my $source_file = 'C:/mydocu~1/db/jokes.xls'; my $source_excel = new Spreadsheet::ParseExcel; my $source_book = $source_excel->Parse($source_file); my $dbh = do_connect(); my $sql = "INSERT INTO mytest VALUES(?,?,?,?); my $sth = $dbh->prepare($sql); # code lifted from a site... my($iR, $iC, $oWkS, $oWkC); foreach my $oWkS (@{$source_book->{Worksheet}}) { for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC); + } } } # $sth->execute(var1, var2, var3, var4); # I know the above line has to be somewhere in the foreach loop but I +just can't figure how :(
In reply to Re: Re: From excel to mysql...
by kiat
in thread From excel to mysql...
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |