Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How to print row of excel file in perl

by sanku (Beadle)
on Nov 11, 2008 at 11:45 UTC ( [id://722827]=note: print w/replies, xml ) Need Help??


in reply to How to print row of excel file in perl

hi, Try out this one actually i am using linux machine so i tried it in linux. Here is the code
#!/usr/bin/perl use strict; use Spreadsheet::ParseExcel; my $file='/tmp/test.xls'; my $excel = Spreadsheet::ParseExcel::Workbook->Parse($file); foreach my $sheet (@{$excel->{Worksheet}}) { $sheet->{MaxRow} ||= $sheet->{MinRow}; foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) { if($row >= 1){ print "Row", $row ,"value =>";} $sheet->{MaxCol} ||= $sheet->{MinCol}; foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) { my $cell = $sheet->{Cells}[$row][$col]; if ($cell) { if($row >= 1){ printf ("%s ", $cell->{Val});} } } if($row >= 1){ print "\n";} } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2026-02-07 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.