Re: Spreadsheet::ParseExcel problem

2012-06-08 Thread rbm
On Jun 7, 3:56 pm, jimsgib...@gmail.com (Jim Gibson) wrote:
> On Jun 6, 2012, at 11:06 PM, rbm wrote:
>
>
>
>
>
>
>
>
>
> > On Jun 7, 12:16 am, jimsgib...@gmail.com (Jim Gibson) wrote:
>
> > I am able to get the methods to return one worksheet or all the
> > worksheets in my workbook but I am unable to find a solution to get
> > either worksheet() or worksheets() to return just 2 of the worksheets.
>
> > I've also tried
>
> > for my $worksheet ( $workbook->worksheets()) {
>
> > which apparently returns array of worksheet objects but I am unable to
> > reference any of these individually e.g.
>
> > $worksheet [3]
>
> > so that I can exclude the worksheets I don't want.
>
> What you want to do is save the array of worksheets:
>
> my @worksheets = $workbook->worksheets();
>
> Now you can access individual worksheets $worksheets[0], etc.

cl :) thank you!


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Spreadsheet::ParseExcel problem

2012-06-07 Thread Jim Gibson

On Jun 6, 2012, at 11:06 PM, rbm wrote:

> On Jun 7, 12:16 am, jimsgib...@gmail.com (Jim Gibson) wrote:
> 
> I am able to get the methods to return one worksheet or all the
> worksheets in my workbook but I am unable to find a solution to get
> either worksheet() or worksheets() to return just 2 of the worksheets.
> 
> 
> I've also tried
> 
> for my $worksheet ( $workbook->worksheets()) {
> 
> which apparently returns array of worksheet objects but I am unable to
> reference any of these individually e.g.
> 
> $worksheet [3]
> 
> so that I can exclude the worksheets I don't want.
> 

What you want to do is save the array of worksheets:

my @worksheets = $workbook->worksheets();

Now you can access individual worksheets $worksheets[0], etc.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Spreadsheet::ParseExcel problem

2012-06-07 Thread rbm
On Jun 7, 12:16 am, jimsgib...@gmail.com (Jim Gibson) wrote:
> On Jun 6, 2012, at 11:33 AM, rbm wrote:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > I'm using perl module Spreadsheet::ParseExcel here
> >http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spr
>
> > I have a Excel spreadsheet which has 8 worksheets in and I would like
> > to parse just worksheets 3 and 4.
>
> > I've tried amending this line in my script every which way but with no
> > joy.
>
> >    for my $worksheet ( $workbook->worksheets() ) {
>
> > The documentation says that the worksheets() method returns an array
> > of worksheets but I cant seem to reference any of these in the usual
> > way in order to syphon out the worksheets that I don't need either.
>
> > When I print out $worksheet I get
>
> > Spreadsheet::ParseExcel::Worksheet=HASH(0x61e3d0)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9b9b0)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ba60)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cab0)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cb40)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cbd0)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cc60)
> > Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ccf0)
>
> The worksheets() method returns an array of worksheet objects. You can then 
> call methods on the worksheet object to extract data from that worksheet.
>
> You can retrieve a specific worksheet object either by name or by index (0-7 
> in your case).
>
> Please see the documentation for the Spreadsheet::ParseExcel module, 
> specifically the Workbook section that describes the worksheets() and 
> worksheet() methods.

Hi,

Thanks for responding.

I have looked at the documentation.

I am able to get the methods to return one worksheet or all the
worksheets in my workbook but I am unable to find a solution to get
either worksheet() or worksheets() to return just 2 of the worksheets.

I've tried

for my $worksheet ( $workbook->worksheet(3) .. $workbook-
>worksheet(4)) {

for my $worksheet ( $workbook->worksheet(3 .. 4)) {

for my $worksheet ( $workbook->worksheets(3 .. 4)) {

I've also tried

for my $worksheet ( $workbook->worksheets()) {

which apparently returns array of worksheet objects but I am unable to
reference any of these individually e.g.

$worksheet [3]

so that I can exclude the worksheets I don't want.

It may be that neither of these methods support any of the things I am
trying to do, but I just wanted to double check I'm using them
correctly before I attempt to find a more long winded solution.

Thanks again for your help with this.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Spreadsheet::ParseExcel problem

2012-06-06 Thread Jim Gibson

On Jun 6, 2012, at 11:33 AM, rbm wrote:

> Hi,
> 
> I'm using perl module Spreadsheet::ParseExcel here
> http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spreadsheet/ParseExcel.pm.
> 
> I have a Excel spreadsheet which has 8 worksheets in and I would like
> to parse just worksheets 3 and 4.
> 
> I've tried amending this line in my script every which way but with no
> joy.
> 
>for my $worksheet ( $workbook->worksheets() ) {
> 
> The documentation says that the worksheets() method returns an array
> of worksheets but I cant seem to reference any of these in the usual
> way in order to syphon out the worksheets that I don't need either.
> 
> When I print out $worksheet I get
> 
> Spreadsheet::ParseExcel::Worksheet=HASH(0x61e3d0)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9b9b0)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ba60)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cab0)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cb40)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cbd0)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cc60)
> Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ccf0)

The worksheets() method returns an array of worksheet objects. You can then 
call methods on the worksheet object to extract data from that worksheet.

You can retrieve a specific worksheet object either by name or by index (0-7 in 
your case).

Please see the documentation for the Spreadsheet::ParseExcel module, 
specifically the Workbook section that describes the worksheets() and 
worksheet() methods.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Spreadsheet::ParseExcel problem

2012-06-06 Thread rbm
Hi,

I'm using perl module Spreadsheet::ParseExcel here
http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spreadsheet/ParseExcel.pm.

I have a Excel spreadsheet which has 8 worksheets in and I would like
to parse just worksheets 3 and 4.

I've tried amending this line in my script every which way but with no
joy.

for my $worksheet ( $workbook->worksheets() ) {

The documentation says that the worksheets() method returns an array
of worksheets but I cant seem to reference any of these in the usual
way in order to syphon out the worksheets that I don't need either.

When I print out $worksheet I get

Spreadsheet::ParseExcel::Worksheet=HASH(0x61e3d0)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9b9b0)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ba60)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cab0)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cb40)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cbd0)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9cc60)
Spreadsheet::ParseExcel::Worksheet=HASH(0xf9ccf0)

It may be that this module doesn't allow for this but I'd really
appreciate any help.

Thank you.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Doubt in Spreadsheet::ParseExcel

2008-10-29 Thread Stewart Anderson
 

  _  

From: anitha victor [mailto:[EMAIL PROTECTED] 
Sent: 29 October 2008 08:54
To: beginners@perl.org
Subject: Doubt in Spreadsheet::ParseExcel

 

Hi Team,

  I want a code snippet for retrieving the content in xcel sheet in a
variable.

Thanks in advance 

The CPAN documentation for this module is  great.

 

I used it forst time without any major difficulties - except  being a
noob to Perl!!

 

Stu

 

Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.
<>

Doubt in Spreadsheet::ParseExcel

2008-10-29 Thread anitha victor
Hi Team,

  I want a code snippet for retrieving the content in xcel sheet in a
variable.

Thanks in advance[?]

---
Anitha victor
<<328.png>>

Re: Problem with Spreadsheet::ParseExcel

2007-05-22 Thread Jenda Krynicky
From: "Nath, Alok (STSD)" <[EMAIL PROTECTED]>
> Hi, 
>   When I call "use Spreadsheet::ParseExcel" in my program I get
> this error.
> 
> Weak references are not implemented in the version of perl at
> C:/Perl/lib/Spreadsheet/ParseExcel.pm line 67
> BEGIN failed--compilation aborted at
> C:/Perl/lib/Spreadsheet/ParseExcel.pm line 67.
> Compilation failed in require at Excel.pl line 5.
> BEGIN failed--compilation aborted at Excel.pl line 5.
> 
> 
>   The line 67 in ParseExcel.pm contains-
>use Scalar::Util qw(weaken);
> 
>   I have also ensured Scalar\Util.pm is in the path.

What version of perl do you have??

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Problem with Spreadsheet::ParseExcel

2007-05-22 Thread Nath, Alok (STSD)
Hi, 
When I call "use Spreadsheet::ParseExcel" in my program I get
this error.

Weak references are not implemented in the version of perl at
C:/Perl/lib/Spreadsheet/ParseExcel.pm line 67
BEGIN failed--compilation aborted at
C:/Perl/lib/Spreadsheet/ParseExcel.pm line 67.
Compilation failed in require at Excel.pl line 5.
BEGIN failed--compilation aborted at Excel.pl line 5.


The line 67 in ParseExcel.pm contains-
 use Scalar::Util qw(weaken);

I have also ensured Scalar\Util.pm is in the path.


Has anybody seen this error before ?

Is there any other module for reading excel files ?

Thanks,
Alok.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread David Van Ginneken
Try something like this.  I just tried it on 60+ files and it seems to
work.  (If you have multiple worksheets you may need to modify the
cell_handler to exclude the ones you don't want)

use Spreadsheet::ParseExcel;
use File::Basename;
use strict;
my $resultMessage = '';
my $maxrow = 0;
my $oBook;
opendir(DIR, "./files");
my @names = readdir(DIR) or die "could not $@";
foreach my $file(@names) {
   next unless $file =~ /.xls$/;
   print "Trying File.. $file\n";
   $maxrow = 0;
   my $excel = new Spreadsheet::ParseExcel(CellHandler =>
\&cell_handler, NotSetCell  => 1);
   $oBook = $excel->Parse("./files/$file") or die "$file . $!";
   $resultMessage.=sprintf("%s,%s\n",basename($file),$maxrow);
}
print $resultMessage . "\n";

sub cell_handler {
   my $row = $_[2];
   $row++;
   $maxrow = $row if $row > $maxrow;
}


On 4/27/05, Craig Moynes <[EMAIL PROTECTED]> wrote:
> Hi Gents,
>I tried both suggestions:
> 
> #
> # For each log in the array
> #   - grab the directory and name of the file.
> #   - send via sendmail
> #
> foreach $hashEntry ( @LOGS )
> {
> 
> my ( $localfile)= $hashEntry->{name};
> my ( $err_msg ) = "";   # error message variable
> 
>     my $cmd = "";
> 
> #
> # Get row count of each file, to generate results file
> #
> my $oBook = new Spreadsheet::ParseExcel::Workbook->Parse($localfile);
> my $oWkS = ${$oBook->{Worksheet}}[0];
> 
> print "-- SHEET: ".$oWkS->{Name}. "\n";
> print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> 
> $resultMessage.=sprintf("%s,%s\n",basename($localfile),$oWkS->{MaxRow});
> }
> 
> But I still get an out of memory error on the 10th file opened.
> 
> Any additional suggestions?
> 
> On 4/27/05, Bakken, Luke <[EMAIL PROTECTED]> wrote:
> > > my $oBook;
> > > my $oWks;
> > > foreach $hashEntry ( @LOGS )
> > > {
> > >
> > >  my ( $localfile)= $hashEntry->{name};
> > >  my ( $err_msg ) = "";   # error message
> > > variable
> > >
> > >
> > >  my $cmd = "";
> > >
> > >  #
> > >  # Get row count of each file, to generate results file
> > >  #
> > >  $oBook = new
> > >  Spreadsheet::ParseExcel::Workbook->Parse($localfile); my
> > >  ($iR, $iC, $oWkS, $oWkC); $oWkS = ${$oBook->{Worksheet}}[0];
> > >
> > >  print "-- SHEET: ".$oWkS->{Name}. "\n";
> > >  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> > >
> > > $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n"; }
> > >
> > > The problem I am running into is after 10 files (in testing all 31
> > > files are the same source file with different names), and then I get
> > > an out of memory error.  Anyone have any idea how I can clean out the
> > > memory.  I have a feeling it might be some autocaching or something
> > > not getting cleaned up within ParseExcel.
> >
> > If you move the 'my $oBook' inside the for loop it the object should be
> > destroyed on each iteration:
> >
> > for my $hashEntry ( @LOGS )
> > {
> >
> >  my ( $localfile)= $hashEntry->{name};
> >  my ( $err_msg ) = "";   # error message
> > variable
> >
> >  my $cmd = "";
> >
> >  #
> >  # Get row count of each file, to generate results file
> >  #
> >  my $oBook = new
> > Spreadsheet::ParseExcel::Workbook->Parse($localfile);
> >  my ($iR, $iC, $oWkC);
> >  my $oWkS = ${$oBook->{Worksheet}}[0];
> >
> >  print "-- SHEET: ".$oWkS->{Name}. "\n";
> >  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> >
> > $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
> > }
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <http://learn.perl.org/> <http://learn.perl.org/first-response>
> >
> >
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread Craig Moynes
Ok perlers, It was actually fairly easy.  

I added a delete just before the end of the for loop.
delete $oBook->{Worksheet};

Not sure how the references work internally in Perl.  I guess that
when oBook is assigned a new Spreadsheet the previous Spreadsheet is
not getting cleaned up.

Cheers,

On 4/27/05, Craig Moynes <[EMAIL PROTECTED]> wrote:
> Hi Gents,
>I tried both suggestions:
> 
> #
> # For each log in the array
> #   - grab the directory and name of the file.
> #   - send via sendmail
> #
> foreach $hashEntry ( @LOGS )
> {
> 
> my ( $localfile)= $hashEntry->{name};
> my ( $err_msg ) = "";   # error message variable
> 
> my $cmd = "";
> 
> #
> # Get row count of each file, to generate results file
> #
> my $oBook = new Spreadsheet::ParseExcel::Workbook->Parse($localfile);
> my $oWkS = ${$oBook->{Worksheet}}[0];
> 
> print "-- SHEET: ".$oWkS->{Name}. "\n";
> print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> 
> $resultMessage.=sprintf("%s,%s\n",basename($localfile),$oWkS->{MaxRow});
> }
> 
> But I still get an out of memory error on the 10th file opened.
> 
> Any additional suggestions?
> 
> On 4/27/05, Bakken, Luke <[EMAIL PROTECTED]> wrote:
> > > my $oBook;
> > > my $oWks;
> > > foreach $hashEntry ( @LOGS )
> > > {
> > >
> > >  my ( $localfile)= $hashEntry->{name};
> > >  my ( $err_msg ) = "";   # error message
> > > variable
> > >
> > >
> > >  my $cmd = "";
> > >
> > >  #
> > >  # Get row count of each file, to generate results file
> > >  #
> > >  $oBook = new
> > >  Spreadsheet::ParseExcel::Workbook->Parse($localfile); my
> > >  ($iR, $iC, $oWkS, $oWkC); $oWkS = ${$oBook->{Worksheet}}[0];
> > >
> > >  print "-- SHEET: ".$oWkS->{Name}. "\n";
> > >  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> > >
> > > $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n"; }
> > >
> > > The problem I am running into is after 10 files (in testing all 31
> > > files are the same source file with different names), and then I get
> > > an out of memory error.  Anyone have any idea how I can clean out the
> > > memory.  I have a feeling it might be some autocaching or something
> > > not getting cleaned up within ParseExcel.
> >
> > If you move the 'my $oBook' inside the for loop it the object should be
> > destroyed on each iteration:
> >
> > for my $hashEntry ( @LOGS )
> > {
> >
> >  my ( $localfile)= $hashEntry->{name};
> >  my ( $err_msg ) = "";   # error message
> > variable
> >
> >  my $cmd = "";
> >
> >  #
> >  # Get row count of each file, to generate results file
> >  #
> >  my $oBook = new
> > Spreadsheet::ParseExcel::Workbook->Parse($localfile);
> >  my ($iR, $iC, $oWkC);
> >  my $oWkS = ${$oBook->{Worksheet}}[0];
> >
> >  print "-- SHEET: ".$oWkS->{Name}. "\n";
> >  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> >
> > $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
> > }
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <http://learn.perl.org/> <http://learn.perl.org/first-response>
> >
> >
> 


-- 
Primer:
   Shane Carruth: It's about some engineers that are trying to build a
device that "degrades" gravity. They find out it has unexplainable
properties. Hilarity ensues.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread Craig Moynes
Hi Gents,
   I tried both suggestions:

#
# For each log in the array
#   - grab the directory and name of the file.
#   - send via sendmail
#
foreach $hashEntry ( @LOGS )
{

my ( $localfile)= $hashEntry->{name};
my ( $err_msg ) = "";   # error message variable


my $cmd = "";

#
# Get row count of each file, to generate results file
#
    my $oBook = new Spreadsheet::ParseExcel::Workbook->Parse($localfile);
my $oWkS = ${$oBook->{Worksheet}}[0];

print "-- SHEET: ".$oWkS->{Name}. "\n";
print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
$resultMessage.=sprintf("%s,%s\n",basename($localfile),$oWkS->{MaxRow});
}

But I still get an out of memory error on the 10th file opened.

Any additional suggestions?

On 4/27/05, Bakken, Luke <[EMAIL PROTECTED]> wrote:
> > my $oBook;
> > my $oWks;
> > foreach $hashEntry ( @LOGS )
> > {
> >
> >  my ( $localfile)= $hashEntry->{name};
> >  my ( $err_msg ) = "";   # error message
> > variable
> >
> >
> >      my $cmd = "";
> >
> >  #
> >  # Get row count of each file, to generate results file
> >  #
> >  $oBook = new
> >  Spreadsheet::ParseExcel::Workbook->Parse($localfile); my
> >  ($iR, $iC, $oWkS, $oWkC); $oWkS = ${$oBook->{Worksheet}}[0];
> >
> >  print "-- SHEET: ".$oWkS->{Name}. "\n";
> >  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> >
> > $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n"; }
> >
> > The problem I am running into is after 10 files (in testing all 31
> > files are the same source file with different names), and then I get
> > an out of memory error.  Anyone have any idea how I can clean out the
> > memory.  I have a feeling it might be some autocaching or something
> > not getting cleaned up within ParseExcel.
> 
> If you move the 'my $oBook' inside the for loop it the object should be
> destroyed on each iteration:
> 
> for my $hashEntry ( @LOGS )
> {
> 
>  my ( $localfile)= $hashEntry->{name};
>  my ( $err_msg ) = "";   # error message
> variable
> 
>  my $cmd = "";
> 
>  #
>  # Get row count of each file, to generate results file
>  #
>  my $oBook = new
> Spreadsheet::ParseExcel::Workbook->Parse($localfile);
>  my ($iR, $iC, $oWkC);
>  my $oWkS = ${$oBook->{Worksheet}}[0];
> 
>  print "-- SHEET: ".$oWkS->{Name}. "\n";
>  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> 
> $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
> }
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread Bakken, Luke
> my $oBook;
> my $oWks;
> foreach $hashEntry ( @LOGS )
> {
> 
>  my ( $localfile)= $hashEntry->{name};
>  my ( $err_msg ) = "";   # error message
> variable 
> 
> 
>  my $cmd = "";
> 
>  #
>  # Get row count of each file, to generate results file
>  #
>  $oBook = new
>  Spreadsheet::ParseExcel::Workbook->Parse($localfile); my
>  ($iR, $iC, $oWkS, $oWkC); $oWkS = ${$oBook->{Worksheet}}[0];
> 
>  print "-- SHEET: ".$oWkS->{Name}. "\n";
>  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> 
> $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n"; }
> 
> The problem I am running into is after 10 files (in testing all 31
> files are the same source file with different names), and then I get
> an out of memory error.  Anyone have any idea how I can clean out the
> memory.  I have a feeling it might be some autocaching or something
> not getting cleaned up within ParseExcel.

If you move the 'my $oBook' inside the for loop it the object should be
destroyed on each iteration:

for my $hashEntry ( @LOGS )
{

 my ( $localfile)= $hashEntry->{name};
 my ( $err_msg )     = "";   # error message
variable 


 my $cmd = "";

 #
 # Get row count of each file, to generate results file
 #
 my $oBook = new
Spreadsheet::ParseExcel::Workbook->Parse($localfile);
 my ($iR, $iC, $oWkC);
 my $oWkS = ${$oBook->{Worksheet}}[0];

 print "-- SHEET: ".$oWkS->{Name}. "\n";
 print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";

$resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread Jay Savage
On 4/26/05, Craig Moynes <[EMAIL PROTECTED]> wrote:
> Hi All,
> I am using the spreadsheet::parseexcel module to open up a series (31)
> spreadsheets and grab the row counts.
> 
> Here is an excerpt with the ParseExcel Code.
> 
> my $oBook;
> my $oWks;
> foreach $hashEntry ( @LOGS )
> {
> 
>  my ( $localfile)= $hashEntry->{name};
>  my ( $err_msg ) = "";   # error message variable
> 
>  my $cmd = "";
> 
>  #
>  # Get row count of each file, to generate results file
>  #
>  $oBook = new Spreadsheet::ParseExcel::Workbook->Parse($localfile);
>  my ($iR, $iC, $oWkS, $oWkC);
>  $oWkS = ${$oBook->{Worksheet}}[0];
> 
>  print "-- SHEET: ".$oWkS->{Name}. "\n";
>  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
>  $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
> }
> 
> The problem I am running into is after 10 files (in testing all 31 files
> are the same source file with different names), and then I get an out of
> memory error.  Anyone have any idea how I can clean out the memory.  I
> have a feeling it might be some autocaching or something not getting
> cleaned up within ParseExcel.
> 
> Cheers,
> Craig


$ResultMessage contains a reference to the ParseExcel object, so the
object never goes out of scope, and each iteration through the block
places a new object in memory.  See Persistent Private Variables in
perldoc perlsub, as well as perlboot, etc.  You need to completel
finish with the object before the block exits.  Try,

$resultMessage.= sprintf("$s,%s\n", basename($localfile), $oWkS->{MaxRow}) ;

or something similar.

HTH,

Jay

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread Craig Moynes
On 4/26/05, Wagner, David --- Senior Programmer Analyst --- WGO
<[EMAIL PROTECTED]> wrote:
> Craig Moynes wrote:
> > Hi All,
> > I am using the spreadsheet::parseexcel module to open up a series (31)
> > spreadsheets and grab the row counts.
> >
> > Here is an excerpt with the ParseExcel Code.
> >
> > my $oBook;
> > my $oWks;
> > foreach $hashEntry ( @LOGS )
> > {
> >
> >  my ( $localfile)= $hashEntry->{name};
> >  my ( $err_msg ) = "";   # error message
> > variable
> >
> >
> >  my $cmd = "";
> >
> >  #
> >  # Get row count of each file, to generate results file
> >  #
> >  $oBook = new
> >  Spreadsheet::ParseExcel::Workbook->Parse($localfile); my
> >  ($iR, $iC, $oWkS, $oWkC); $oWkS = ${$oBook->{Worksheet}}[0];
> >
> >  print "-- SHEET: ".$oWkS->{Name}. "\n";
> >  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> >
> > $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n"; }
> No where do I see you closing or destroying the existing data 
> structure.  I was >working on similiar item and only wanted the first row and 
> last column, but it was loading >the whole file in. Forunately one of the 
> Perl gurus provided a work around, but to get the >last row of each Excel 
> file will require the loading of the whole file, unless some guru has a >work 
> around that cheats loading the whole file.

I thought that by defining the oBook and oWks variables outside the
for loop, that the memory for an old object referenced in those
variables would be garbage collected when reassigned.  Can you paste a
code sample for the garbage collection stuff that the gurus supplied
you with.

Cheers,
   Craig

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: Spreadsheet::ParseExcel - Out of memory error

2005-04-26 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Craig Moynes wrote:
> Hi All,
> I am using the spreadsheet::parseexcel module to open up a series (31)
> spreadsheets and grab the row counts.
> 
> Here is an excerpt with the ParseExcel Code.
> 
> my $oBook;
> my $oWks;
> foreach $hashEntry ( @LOGS )
> {
> 
>  my ( $localfile)= $hashEntry->{name};
>  my ( $err_msg ) = "";   # error message
> variable 
> 
> 
>  my $cmd = "";
> 
>  #
>  # Get row count of each file, to generate results file
>  #
>  $oBook = new
>  Spreadsheet::ParseExcel::Workbook->Parse($localfile); my
>  ($iR, $iC, $oWkS, $oWkC); $oWkS = ${$oBook->{Worksheet}}[0];
> 
>  print "-- SHEET: ".$oWkS->{Name}. "\n";
>  print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
> 
> $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n"; }
> 
> The problem I am running into is after 10 files (in testing all 31
> files are the same source file with different names), and then I get
> an out of memory error.  Anyone have any idea how I can clean out the
> memory.  I have a feeling it might be some autocaching or something
> not getting cleaned up within ParseExcel.
> 
No where do I see you closing or destroying the existing data 
structure.  I was working on similiar item and only wanted the first row and 
last column, but it was loading the whole file in. Forunately one of the Perl 
gurus provided a work around, but to get the last row of each Excel file will 
require the loading of the whole file, unless some guru has a work around that 
cheats loading the whole file.

Wags ;)
> Cheers,
> Craig



***
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
***


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Spreadsheet::ParseExcel - Out of memory error

2005-04-26 Thread Craig Moynes
Hi All,
I am using the spreadsheet::parseexcel module to open up a series (31) 
spreadsheets and grab the row counts.

Here is an excerpt with the ParseExcel Code.
my $oBook;
my $oWks;
foreach $hashEntry ( @LOGS )
{
my ( $localfile)= $hashEntry->{name};
my ( $err_msg ) = "";   # error message variable
my $cmd = "";
#
# Get row count of each file, to generate results file
#
$oBook = new Spreadsheet::ParseExcel::Workbook->Parse($localfile);
my ($iR, $iC, $oWkS, $oWkC);
$oWkS = ${$oBook->{Worksheet}}[0];
print "-- SHEET: ".$oWkS->{Name}. "\n";
print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
$resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
}
The problem I am running into is after 10 files (in testing all 31 files 
are the same source file with different names), and then I get an out of 
memory error.  Anyone have any idea how I can clean out the memory.  I 
have a feeling it might be some autocaching or something not getting 
cleaned up within ParseExcel.

Cheers,
   Craig
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Spreadsheet::ParseExcel - Out of memory error

2005-04-26 Thread Craig Moynes
I have a piece of code that needs to open 31 excel spreadsheets, find
out the row count for each.  When it runs it gets about 10 files in
and crashes with an Out of memory error.

Here is an excerpt from the code:
my $oBook;
my $oWks;
my ($iR, $iC, $oWkS, $oWkC);
foreach $hashEntry ( @LOGS )
{

my ( $localfile)= $hashEntry->{name};
my ( $err_msg ) = "";   # error message variable


my $cmd = "";

#
# Get row count of each file, to generate results file
    #
   $oBook = new Spreadsheet::ParseExcel::Workbook->Parse($localfile);
   $oWkS = ${$oBook->{Worksheet}}[0];

   print "-- SHEET: ".$oWkS->{Name}. "\n";
   print "Row: ".$oWkS->{MinRow}." v ".$oWkS->{MaxRow}."\n";
   $resultMessage.=basename($localfile).",".$oWkS->{MaxRow}."\n";
}


Is there anything I can do to 'dump' the memory.  My initial feeling
is something in ParseExcel, or one of the dependencies isn't playing
nice...or rather I am not letting it play nice through some inaction
or action on my part.

Anyone have some ideas on dealing with this memory problem?

Cheers,
   Craig

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Spreadsheet::ParseExcel date problem (year is being reformatted)

2002-12-16 Thread Max
If I use $osheetCR->{Val} the value is in incremental serial numbers 
from 1 jan 1900 (or 1 jan 1904 for Apple users).
Example: 12-1-1946 is 16814

I can convert 16814 back to the real date with the date::calc but there 
must be some way to extract the year in the right format ( and not yy).

Max

NYIMI Jose (BMB) wrote:

$oSheetCR->Value #formatted value
$oSheetCR->{Val} #original value

José.

 

-Original Message-
From: Max [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, December 10, 2002 4:50 PM
To: [EMAIL PROTECTED]
Subject: Spreadsheet::ParseExcel date problem (year is being 
reformatted)


When I read an Excel file in, ParseExcel reformates the year to 
dd-mm-*yy* (for example 10 dec 2002 is 10-12-*02*).
I don't want this to happen, the format should stay the way it was 
dd-mm-** (10-12-*2002*).

Here is the code:

use Spreadsheet::ParseExcel;  
 
   # Spread-ParseExcel [0.26]
   my $oExcel = new Spreadsheet::ParseExcel;
   my $oBook = $oExcel->Parse('mail/file.xls');

   my($iRow, $iColom, $oWorkSheet, $oSheetCR);

   my $iSheet=0;
   my @string;  
   $oWorkSheet = $oBook->{Worksheet}[$iSheet];

   for (my $iRow = $oWorkSheet->{MinRow}; defined 
$oWorkSheet->{MaxRow} 
&& $iRow <= $oWorkSheet->{MaxRow} ; $iRow++){
   for(my $iColom = $oWorkSheet->{MinCol} ; defined 
$oWorkSheet->{MaxCol} && $iColom <= $oWorkSheet->{MaxCol} ; 
$iColom++) {
   $oSheetCR = $oWorkSheet->{Cells}[$iRow][$iColom];
   push @string,$oSheetCR->Value if ($oSheetCR);
   }
   }

Any help is appreciated,

Max

   



 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent.


 



Spreadsheet::ParseExcel Problem

2002-12-12 Thread Balint, Jess
Hi all. I send this today to ask what in the world is going on with my
program. I am getting the following error:

Argument "" isn't numeric in le at (eval 4099) line 2.
Argument "" isn't numeric in le at (eval 4100) line 2.
Argument "" isn't numeric in le at (eval 4101) line 2.

Line 2 of my program is blank and I can't quite understand. This. If anyone
has any idea, that'd be great. Thanks alot.

jess

Program Text:

1:#!/usr/local/bin/perl -w
2:
3:use lib qw( /qmds/jbalint/perl/lib/site_perl/5.005 );
4:use strict;
5:use Spreadsheet::ParseExcel;
6:
7:my $outpath = "textfiles";
8:my $y = 0;
9:
10:open( LOG, "> combine_files.log" );
11:
12:for my $file_name () {
13: my $x = 0;
14: $y++;
15: open( OUTFILE, "> $outpath/File_$y.dat" )
16: or die( "Cannot open output file
($file_name,$outpath/File_$y.dat): $!\n");
17: my $xlBook = Spreadsheet::ParseExcel::Workbook->Parse($file_name);
18: print LOG "Now parsing: $file_name\n";
19: my $xlSheet = $xlBook->{Worksheet}[0];
20: print LOG "Excel says there are ", $xlSheet->{MaxRow}, " rows and ",
$xlSheet->{MaxCol}, " columns.\n";
21: for( my $r = $xlSheet->{MinRow}; defined $xlSheet->{MaxRow} && $r <
$xlSheet->{MaxRow} ; $r++ ) {
22: for( my $c = $xlSheet->{MinCol} ; defined $xlSheet->{MaxCol}
&& $c <= $xlSheet->{MaxCol} ; $c++ ) {
23: my $xlCell = $xlSheet->{Cells}[$r+1][$c];
24: $xlCell ? print OUTFILE $xlCell->{Val}, "," : print
OUTFILE ",";
25: }
26: $x++;
27: print OUTFILE "\n";
28: }
29: close( OUTFILE );
30: print LOG "Total of $x row parsed. Output file is
$outpath/File_$y.dat\n";
31:}
32:
33:close( LOG );

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Spreadsheet::ParseExcel date problem (year is being reformatted)

2002-12-12 Thread Mystik Gotan
$var =~ s/.{2}$//; # ? or + should do the trick easier (instead of {2}
  # but this shouldn't be as bad either. It just deletes 
the last 2 characters, no matter what characters they are.



--
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]





From: Max <[EMAIL PROTECTED]>
To: Mystik Gotan <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: Spreadsheet::ParseExcel date problem (year is being 
reformatted)
Date: Thu, 12 Dec 2002 10:10:16 +0100

My e-mail was changed, I use bold to highlight yy (02) and  (2002).
Somehow the [EMAIL PROTECTED] mailing list changed this to *yy* (*02*) and 
** (*2002*).

So the problem isn't the asteriks but that ParseExcel converts a four 
character year:  to a two character year: yy
Anybody now how to prevent this?

Mystik Gotan wrote:

Regex?

$var =~ s/\b\**\**\b//; # deletes *



--
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]






From: Max <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Spreadsheet::ParseExcel date problem (year is being reformatted)
Date: Tue, 10 Dec 2002 16:50:04 +0100

When I read an Excel file in, ParseExcel reformates the year to 
dd-mm-*yy* (for example 10 dec 2002 is 10-12-*02*).
I don't want this to happen, the format should stay the way it was 
dd-mm-** (10-12-*2002*).

Here is the code:

use Spreadsheet::ParseExcel;  
 # Spread-ParseExcel [0.26]
   my $oExcel = new Spreadsheet::ParseExcel;
   my $oBook = $oExcel->Parse('mail/file.xls');

   my($iRow, $iColom, $oWorkSheet, $oSheetCR);

   my $iSheet=0;
   my @string; $oWorkSheet = 
$oBook->{Worksheet}[$iSheet];

   for (my $iRow = $oWorkSheet->{MinRow}; defined $oWorkSheet->{MaxRow} 
&& $iRow <= $oWorkSheet->{MaxRow} ; $iRow++){
   for(my $iColom = $oWorkSheet->{MinCol} ; defined 
$oWorkSheet->{MaxCol} && $iColom <= $oWorkSheet->{MaxCol} ; $iColom++) {
   $oSheetCR = $oWorkSheet->{Cells}[$iRow][$iColom];
   push @string,$oSheetCR->Value if ($oSheetCR);
   }
   }

Any help is appreciated,

Max



_
Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met 
Hotmail SMS http://www.msn.nl/jumppage/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



_
Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail 
SMS http://www.msn.nl/jumppage/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Spreadsheet::ParseExcel date problem (year is being reformatted)

2002-12-12 Thread NYIMI Jose (BMB)
$oSheetCR->Value #formatted value
$oSheetCR->{Val} #original value

José.

> -Original Message-
> From: Max [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 10, 2002 4:50 PM
> To: [EMAIL PROTECTED]
> Subject: Spreadsheet::ParseExcel date problem (year is being 
> reformatted)
> 
> 
> When I read an Excel file in, ParseExcel reformates the year to 
> dd-mm-*yy* (for example 10 dec 2002 is 10-12-*02*).
> I don't want this to happen, the format should stay the way it was 
> dd-mm-** (10-12-*2002*).
> 
> Here is the code:
> 
> use Spreadsheet::ParseExcel;  
>   
>     # Spread-ParseExcel [0.26]
> my $oExcel = new Spreadsheet::ParseExcel;
> my $oBook = $oExcel->Parse('mail/file.xls');
> 
> my($iRow, $iColom, $oWorkSheet, $oSheetCR);
> 
> my $iSheet=0;
> my @string;  
> $oWorkSheet = $oBook->{Worksheet}[$iSheet];
> 
> for (my $iRow = $oWorkSheet->{MinRow}; defined 
> $oWorkSheet->{MaxRow} 
> && $iRow <= $oWorkSheet->{MaxRow} ; $iRow++){
> for(my $iColom = $oWorkSheet->{MinCol} ; defined 
> $oWorkSheet->{MaxCol} && $iColom <= $oWorkSheet->{MaxCol} ; 
> $iColom++) {
> $oSheetCR = $oWorkSheet->{Cells}[$iRow][$iColom];
> push @string,$oSheetCR->Value if ($oSheetCR);
> }
> }
> 
> Any help is appreciated,
> 
> Max
> 


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Spreadsheet::ParseExcel date problem (year is being reformatted)

2002-12-12 Thread Max
My e-mail was changed, I use bold to highlight yy (02) and  (2002).
Somehow the [EMAIL PROTECTED] mailing list changed this to *yy* (*02*) 
and ** (*2002*).

So the problem isn't the asteriks but that ParseExcel converts a four 
character year:  to a two character year: yy
Anybody now how to prevent this?

Mystik Gotan wrote:

Regex?

$var =~ s/\b\**\**\b//; # deletes *



--
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]






From: Max <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Spreadsheet::ParseExcel date problem (year is being 
reformatted)
Date: Tue, 10 Dec 2002 16:50:04 +0100

When I read an Excel file in, ParseExcel reformates the year to 
dd-mm-*yy* (for example 10 dec 2002 is 10-12-*02*).
I don't want this to happen, the format should stay the way it was 
dd-mm-** (10-12-*2002*).

Here is the code:

use 
Spreadsheet::ParseExcel;   
# Spread-ParseExcel [0.26]
   my $oExcel = new Spreadsheet::ParseExcel;
   my $oBook = $oExcel->Parse('mail/file.xls');

   my($iRow, $iColom, $oWorkSheet, $oSheetCR);

   my $iSheet=0;
   my @string; $oWorkSheet = 
$oBook->{Worksheet}[$iSheet];

   for (my $iRow = $oWorkSheet->{MinRow}; defined 
$oWorkSheet->{MaxRow} && $iRow <= $oWorkSheet->{MaxRow} ; $iRow++){
   for(my $iColom = $oWorkSheet->{MinCol} ; defined 
$oWorkSheet->{MaxCol} && $iColom <= $oWorkSheet->{MaxCol} ; $iColom++) {
   $oSheetCR = $oWorkSheet->{Cells}[$iRow][$iColom];
   push @string,$oSheetCR->Value if ($oSheetCR);
   }
   }

Any help is appreciated,

Max



_
Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met 
Hotmail SMS http://www.msn.nl/jumppage/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Spreadsheet::ParseExcel date problem (year is being reformatted)

2002-12-11 Thread Mystik Gotan
Regex?

$var =~ s/\b\**\**\b//; # deletes *



--
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]






From: Max <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Spreadsheet::ParseExcel date problem (year is being reformatted)
Date: Tue, 10 Dec 2002 16:50:04 +0100

When I read an Excel file in, ParseExcel reformates the year to dd-mm-*yy* 
(for example 10 dec 2002 is 10-12-*02*).
I don't want this to happen, the format should stay the way it was 
dd-mm-** (10-12-*2002*).

Here is the code:

use Spreadsheet::ParseExcel;   
# Spread-ParseExcel [0.26]
   my $oExcel = new Spreadsheet::ParseExcel;
   my $oBook = $oExcel->Parse('mail/file.xls');

   my($iRow, $iColom, $oWorkSheet, $oSheetCR);

   my $iSheet=0;
   my @string; $oWorkSheet = 
$oBook->{Worksheet}[$iSheet];

   for (my $iRow = $oWorkSheet->{MinRow}; defined $oWorkSheet->{MaxRow} && 
$iRow <= $oWorkSheet->{MaxRow} ; $iRow++){
   for(my $iColom = $oWorkSheet->{MinCol} ; defined 
$oWorkSheet->{MaxCol} && $iColom <= $oWorkSheet->{MaxCol} ; $iColom++) {
   $oSheetCR = $oWorkSheet->{Cells}[$iRow][$iColom];
   push @string,$oSheetCR->Value if ($oSheetCR);
   }
   }

Any help is appreciated,

Max


_
Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail 
SMS http://www.msn.nl/jumppage/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Spreadsheet::ParseExcel date problem (year is being reformatted)

2002-12-11 Thread Max
When I read an Excel file in, ParseExcel reformates the year to 
dd-mm-*yy* (for example 10 dec 2002 is 10-12-*02*).
I don't want this to happen, the format should stay the way it was 
dd-mm-** (10-12-*2002*).

Here is the code:

use Spreadsheet::ParseExcel;
   # Spread-ParseExcel [0.26]
   my $oExcel = new Spreadsheet::ParseExcel;
   my $oBook = $oExcel->Parse('mail/file.xls');

   my($iRow, $iColom, $oWorkSheet, $oSheetCR);

   my $iSheet=0;
   my @string;  
   $oWorkSheet = $oBook->{Worksheet}[$iSheet];

   for (my $iRow = $oWorkSheet->{MinRow}; defined $oWorkSheet->{MaxRow} 
&& $iRow <= $oWorkSheet->{MaxRow} ; $iRow++){
   for(my $iColom = $oWorkSheet->{MinCol} ; defined 
$oWorkSheet->{MaxCol} && $iColom <= $oWorkSheet->{MaxCol} ; $iColom++) {
   $oSheetCR = $oWorkSheet->{Cells}[$iRow][$iColom];
   push @string,$oSheetCR->Value if ($oSheetCR);
   }
   }

Any help is appreciated,

Max


Re: Spreadsheet::ParseExcel

2002-08-04 Thread Connie Chan

Have you check those related modules are installed ?

IO::Scalar
OLE::Storage_Lite

Seems the problem starts from IO::Scalar, 
try to upgrade or remove and install it again

Rgds,
Connie


- Original Message - 
From: "Hytham Shehab" <[EMAIL PROTECTED]>
To: "perl" <[EMAIL PROTECTED]>
Sent: Monday, August 05, 2002 12:26 AM
Subject: Spreadsheet::ParseExcel


> hi guys,
> am using activeperl v 5.6.1 on XP, then when i start my script:
> #!c:\perl\bin\perl.exe
> use strict;
> use Spreadsheet::ParseExcel;
> .
> then run it, it gave me the error(s):
> Can't locate IO/Scalar.pm in @INC (@INC contains: C:/Perl/lib
> C:/Perl/site/lib .
> ) at C:/Perl/site/lib/OLE/Storage_Lite.pm line 171.
> BEGIN failed--compilation aborted at C:/Perl/site/lib/OLE/Storage_Lite.pm
> line 1
> 71.
> Compilation failed in require at C:/Perl/site/lib/Spreadsheet/ParseExcel.pm
> line
>  103.
> BEGIN failed--compilation aborted at
> C:/Perl/site/lib/Spreadsheet/ParseExcel.pm
> line 103.
> Compilation failed in require at excel.pl line 4.
> BEGIN failed--compilation aborted at excel.pl line 4.
> 
> i have installed the module using PPM, and you can rest assure that it is
> there.
> 
> thx. very much
> 
> --
> Hytham Shehab
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Spreadsheet::ParseExcel

2002-08-04 Thread Hytham Shehab

hi guys,
am using activeperl v 5.6.1 on XP, then when i start my script:
#!c:\perl\bin\perl.exe
use strict;
use Spreadsheet::ParseExcel;
.
then run it, it gave me the error(s):
Can't locate IO/Scalar.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .
) at C:/Perl/site/lib/OLE/Storage_Lite.pm line 171.
BEGIN failed--compilation aborted at C:/Perl/site/lib/OLE/Storage_Lite.pm
line 1
71.
Compilation failed in require at C:/Perl/site/lib/Spreadsheet/ParseExcel.pm
line
 103.
BEGIN failed--compilation aborted at
C:/Perl/site/lib/Spreadsheet/ParseExcel.pm
line 103.
Compilation failed in require at excel.pl line 4.
BEGIN failed--compilation aborted at excel.pl line 4.

i have installed the module using PPM, and you can rest assure that it is
there.

thx. very much

--
Hytham Shehab


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Newbie using Spreadsheet::ParseExcel

2001-10-18 Thread Lotto

I had the -w option on (!/usr/bin/perl -w).  When I took out the -w, the mystery
message went away.  I'm still a bit disturbed that I ever got it, but the
program runs fine.

Lotto.
.

P.S. Sorry about all of those reposts, it took forever for the posts to appear
for me, and I thought I was doing something wrong during posting.

Eric Lotto wrote:

> Forgive me if this post is a duplicate.  I tried sending it through my
> newsgroup reader first, and it did not seem to get through.
>
> I wrote a program (on linux platform) to read in an Excel file, and write
> the data out to a fixed-length field file.  I used the ParseExcel module,
> but it loads the entire Excel file into memory.  This works great for test
> files, but the files it will actually be used for are much too large.
> So I am now rewriting the program to use the CellHandler with Parse.
> Unfortunately Parse skips cells which are null, which leaves fields out.
> This does not work for a fixed-length file.  I think I found a way around
> it, and it is ugly.  Furthermore, I get the message "Use of uninitialized
> value at" when I am looping through the missing fields.  It is very odd
> behavior (or at least it seems so to me) because if I put the exact same
> line of code in another area, that line will not generate that message.
>
> Here is my subCellHandler:
>
> 
> sub subCellHandler($) {
>   my($ovBook, $ivSheet, $ivRow, $ivCol, $ovCell) = @_;
>   if($ivSheet != $sheet){ return;}
>   if(($skip != "0") && ($ivRow == 0)){  #skip cells in first
> row (headers)
> $iRow = 1;
> return;
>   }
>   if($ivCol >= $numCol){ return;}   #cell outside of
> requested fields
>   while(($iCol != $ivCol) || ($iRow != $ivRow)){
> $iCol++;
> if($iCol > $numCol){#new row
>   print OUTFILE "\n";
>   $iRow++;
>   $iCol = 0;
> }
> if(($iCol != $ivCol) || ($iRow != $ivRow)){ #if still unequal,
> have blank cell(s)
>   print OUTFILE " " x ($colWidth[$iCol]);
> }
>   }  #end of while($iCol...)
>   $printValue = $ovCell->Value;
>   $lengthDif = $colWidth[$ivCol];
>   $lengthDif = $lengthDif - length($printValue);
>   if($lengthDif > 0){ $printValue = $printValue . " " x $lengthDif; }   #pad
> field with spaces
>   elsif($lengthDif < 0){#cell value is too big to
> fit in fixed field
> $strChopped = "";
> for(my $i = 0; $i > $lengthDif; $i--){ $strChopped = chop($printValue) .
> $strChopped; }
> print STDERR "String \"$strChopped\" removed from end of Row:",
> $ivRow+1, " Column:", $ivCol+1, "\n";
>   }
>   print OUTFILE $printValue
>or die "Error printing cell: R:", $ivRow+1, " C:", $ivCol+1,"\nAborting
> conversion.\nErrored out ";
> }  #End of subCellHandler()
> 
> *
> The mystery message seems to come from the line with the "if still unequal,
> have blank cell(s)" comment.
>
> Thank you much,
> Lotto.
> .


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Anyone have experience with Spreadsheet::ParseExcel module?

2001-07-15 Thread Jason Purdy

I sent in a note to the author, as I believe it's a bug within the module code, but I 
thought just for thoroughness, I should also send a note in here and make sure it's 
not a problem with my code.  (my order of doing this is prolly wrong, too, but that's 
for another thread ;))

I'm using the standard example code from its documentation, with a few minor tweaks:

# now we open/parse the Excel file
    my $oExcel = new Spreadsheet::ParseExcel;

#1.1 Normal Excel97
my $oBook = $oExcel->Parse($tmpFile);
my($iR, $iC, $oWkS, $oWkC);
#print "FILE  :", $oBook->{File} , "\n" if $DEBUGGING;
#print "COUNT :", $oBook->{SheetCount} , "\n" if $DEBUGGING;
#print "AUTHOR:", $oBook->{Author} , "\n" if $DEBUGGING;
$oWkS = $oBook->{Worksheet}[0];
print "- SHEET:", $oWkS->{Name}, "\n" if $DEBUGGING;
for(my $iR = $oWkS->{MinRow} ; 
defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) {
my @rowValues = ();
for(my $iC = $oWkS->{MinCol} ;
defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) {
$oWkC = $oWkS->{Cells}[$iR][$iC];
my ($tempValue) = ($oWkC && $oWkC->Value ne '') ? $oWkC->Value : 
'BLANK_AND_IGNORE';
print "TEMPVALUE = $tempValue\n" if $DEBUGGING;
push (@rowValues, $tempValue);
}
processRow (@rowValues);
}
}

Now if the Excel file has a cell whose value contains a comma, I receive two cells 
instead of one.  So if the cell contained "Perl, Excel", the TEMPVALUE output would be:

TEMPVALUE = Perl
TEMPVALUE = Excel

Any thoughts/ideas?

Thanks in advance!

Jason