Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

parsing an excel spreadsheet into a SQL insert statement

by JSchmitz (Canon)
on Apr 05, 2001 at 21:11 UTC ( #70165=perlquestion: print w/replies, xml ) Need Help??

JSchmitz has asked for the wisdom of the Perl Monks concerning the following question:

Here at work I need to parse data from a 12 column spreadsheet
into a SQL insert statement. Can anyone point me in the right
direction?
  • Comment on parsing an excel spreadsheet into a SQL insert statement

Replies are listed 'Best First'.
Re: parsing an excel spreadsheet into a SQL insert statement
by Albannach (Prior) on Apr 05, 2001 at 21:16 UTC
    Here's a good direction to start in: Spreadsheet::ParseExcel.

    For future reference, the CPAN nodelet is great - type "excel", hit the button and you get the above module.

    --
    I'd like to be able to assign to an luser

      Cool thanks - problem solved - this is exactly what I needed
      use strict; use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; #1.1 Normal Excel97 my $oBook = $oExcel->Parse('Excel/Test97.xls'); my($iR, $iC, $oWkS, $oWkC); print "FILE :", $oBook->{File} , "\n"; print "COUNT :", $oBook->{SheetCount} , "\n"; print "AUTHOR:", $oBook->{Author} , "\n"; for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { $oWkS = $oBook->{Worksheet}[$iSheet]; print "--------- SHEET:", $oWkS->{Name}, "\n"; for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $i +R++) { 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) +; } } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://70165]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2020-07-07 19:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?