#!/usr/bin/perl use strict; use DBI; use Spreadsheet::ParseExcel; # connect to DB & prepare statement handle my $dbh = DBI->connect("your:dsn:here"); my $sth = $dbh->prepare("INSERT INTO table (foo,bar) values(?,?)"); # get workbook my $file = $ARGV[0] || usage(); my $parser = Spreadsheet::ParseExcel->new(); my $book = $parser->Parse($file) || die("No workbook found!"); # get the first worksheet my $sheet = $book->{Worksheet}[0]; my ($min, $max) = $sheet->RowRange(); # iterate over each row... foreach my $row ($min..$max) { # get the values in each column you want... my $name = $sheet->Cell($row,1)->Value; my $address = $sheet->Cell($row,2)->Value(); # and add a new row $sth->execute($name, $address); } $dbh->disconnect();