I was doing this project and I tried to use the Spreadsheet::ParseExcel::Simple module. Anyways, I have a question regarding how it works. Basically, is there any way to control where the parser fetches the data to? For example, I have a spreadsheet that has 4 sheets. I want to get data from the 2nd sheet alone. Is there any way to specify it so that it'd ONLY get data from that one sheet alone? I also want to have some control as to methods to extract bits of data from certain elements inside the array(s) as well.
Also wanted to ask about methods of going through the array and getting specific data from the elements inside it.
I tried to rewrite it like this:
#!/usr/bin/perl
use Spreadsheet::ParseExcel::Simple;
my $xls = Spreadsheet::ParseExcel::Simple->read('spreadsheet.xls');
foreach my $sheet ($xls->sheets) {
while ($sheet->has_data) {
my @data = $sheet->next_row;
print @data[5];
}
}
But it only gets the 5th element (of all the rows), of all the sheets. Is there a way to get specific columns, specific rows, and specific sheets?
The module can be found at:
Spreadsheet::ParseExcel::Simple
I know this is alot to ask, but I would really appreciate the assistance. Thank you.
Edit: <code> tags, CPAN link and some minor formatting, larsen
Title edit by tye
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.