kyle972
asked on
Perl CSV Ignore First Line and Export to Access
I am trying to insert the values from a CVS file (with the first row being headers) into an Access Database using a Perl script. The script works, but i need to exclude the first line of the csv file which contains the headers.
Any ideas?
Any ideas?
use DBI;
$csvfile="C:/WeatherModel/degrib/bin/Model/Output/gfs_2010111900_72.csv";
$dbh = DBI->connect('dbi:ODBC:driver=Microsoft Access Driver (*.mdb);dbq=c:/weathermodel/weathermodel.mdb', '', '');
$sth = $dbh->prepare( "INSERT INTO GFS_Forecasts VALUES (?,?,?,?,?,?)" );
open CSV, $csvfile;
while(<CSV>) {
chomp;
my @fields = split /,/;
$sth->execute(@fields);
}
close CVS;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.