Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: parsing excel sheet from a perl program

by jrsimmon (Hermit)
on Mar 08, 2010 at 19:49 UTC ( [id://827421]=note: print w/replies, xml ) Need Help??


in reply to parsing excel sheet from a perl program

Two things:

  • You need to test for the success of your parse call
  • You should print the values around each of your conditionals/loops to see why you're not entering them

use strict; use Spreadsheet::ParseExcel; my $excel = Spreadsheet::ParseExcel::Workbook->Parse("C:\\au.xls"); die "Parse failed" unless defined $excel; my $excel_file_url; #start looping the Excel sheet foreach my $sheet (@{$excel->{Worksheet}}) { $sheet->{MaxRow} ||= $sheet->{MinRow}; print "$sheet->{MaxRow}\t$sheet->{MinRow}\n"; foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) { print "Row: $row\n"; #looping for each row if ($row > 1) { #get the file url path from excel sheet at corresponding +row,+ col 0 my $cell_value=$sheet->{Cells}[$row][0]; $excel_file_url=$cell_value->{Val}; print $excel_file_url; } } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://827421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2025-02-08 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (95 votes). Check out past polls.