Loading ...
Sorry, an error occurred while loading the content.
 

RE: [PBML] Re: Need starting idea for Spreadsheet::ParseExcel module

Expand Messages
  • Jacques Mostert
    If you knew C++ you could have written a small program that can open an Excel database and export everything through the HTTP protocol to a online page: (i.e.
    Message 1 of 4 , Oct 16, 2004
      If you knew C++ you could have written a small program that can
      open an Excel database and export everything through the HTTP protocol
      to a online page:
      (i.e. http://www.domain.com/php/update_sql.php?...) with the GET request
      to the php script and there by supplying the parameters necessary to tell
      the php script what row and column you are updating with the data
      parameters.

      This might look like being a slow approach, but it's the only
      thing I could think up without doing any effort. *LOL*

      I hope this helps.


      See ya.

      -Jacques.

      -----Original Message-----
      From: Mike Flannigan [mailto:mikeflan@...]
      Sent: 15 October 2004 07:59 PM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] Re: Need starting idea for Spreadsheet::ParseExcel module




      > Date: Thu, 14 Oct 2004 22:56:09 -0500
      > From: Sam Munzani <smunzani@...>
      > Subject: Need starting idea for Spreadsheet::ParseExcel module
      >
      > Hi,
      >
      > I need some hints to code following. I tried modifying samples from CPAN
      > but so far nothing helped.
      > I have a spreadsheet with 600+ lines and 98 columns. Data is in
      > following format.
      >
      > sitename unitnum addr phone type wanip lanip .....
      > After this header line, 630 lines of actual data.
      >
      > What I want to do is import this data in to a 2 dimentional hash or an
      > array of hash.
      > Innner most hash: $hash{$unitnum}="Selective column cell values from the
      > 98 column cells. e.g. column A, D, G, AB, BB, CA"
      > This hash represents one site.
      > Now I need hash of this hash like
      > $hash{$site}{$unitnum};
      > Where $site represents each line.
      >
      > I tried following sample modification but didn't help.
      > #!/usr/bin/perl -w
      >
      > use strict;
      > use Spreadsheet::ParseExcel;
      >
      > my $oExcel = new Spreadsheet::ParseExcel;
      >
      > die "You must provide a filename to $0 to be parsed as an Excel file"
      > unless @ARGV;
      >
      > my $oBook = $oExcel->Parse($ARGV[0]);
      > my($iR, $iC, $oWkS, $oWkC);
      > print "FILE :", $oBook->{File} , "\n";
      > print "COUNT :", $oBook->{SheetCount} , "\n";
      >
      > print "AUTHOR:", $oBook->{Author} , "\n"
      > if defined $oBook->{Author};
      >
      > 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} ;
      > $iR++)
      > {
      > for(my $iC = $oWkS->{MinCol} ;
      > defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
      > $iC++)
      > {
      > $oWkC = $oWkS->{Cells}[$iR][$iC];
      > push(@test,$oWkC->Value);
      > # print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC);
      > print "$oWkC->Value, "\n" if($oWkC);
      > }
      > $SITEINFO{$test[6]}=$test[0] . "," . $test[1];
      > }
      > }
      >
      > Any ideas are greatly appreiated.
      >
      > Thanks,
      > Sam

      If you only have to do it once, consider exporting to a tab
      delimited text file and working on the text file. Even if you
      need to do it more than once you might want to consider
      this shortcut.


      Mike Flannigan





      Unsubscribing info is here:
      http://help.yahoo.com/help/us/groups/groups-32.html
      Yahoo! Groups Links
    Your message has been successfully submitted and would be delivered to recipients shortly.