Attempting to use Spreadsheet::Read and find its documentation rather sparse. I can read a cell, but cannot read an entire row or entire sheet using the row or rows functions.
Tried both of these
use Spreadsheet::Read;
use Spreadsheet::Read qw(row rows);
Here is my code:
my $ref2 = ReadData ("test.xls");
my @row = row($ref2, 6);<br>
for (my $i=0; $i<=$#row; $i++) {
print "$row[$i]\n";
}
my @rows = rows($ref2);
# print the whole thing one at a time
for $i ( 0 .. $#rows ) {
for $j ( 0 .. $#{$rows[$i]} ) {
print "element $i $j is $rows[$i][$j]\n";
}
}
with this use:
use Spreadsheet::Read;
I get this error: Undefined subroutine &main::row
with this use:
use Spreadsheet::Read qw(row rows);
I don't get the error, but do not get any data output.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.