| 1 |
NAME |
| 2 |
Spreadsheet::ParseExcel::Simple - A simple interface to Excel data |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
my $xls = Spreadsheet::ParseExcel::Simple->read('spreadsheet.xls'); |
| 6 |
foreach my $sheet ($xls->sheets) { |
| 7 |
while ($sheet->has_data) { |
| 8 |
my @data = $sheet->next_row; |
| 9 |
} |
| 10 |
} |
| 11 |
|
| 12 |
DESCRIPTION |
| 13 |
This provides an abstraction to the Spreadsheet::ParseExcel module for |
| 14 |
simple reading of values. |
| 15 |
|
| 16 |
You simply loop over the sheets, and fetch rows to arrays. |
| 17 |
|
| 18 |
For anything more complex, you probably want to use |
| 19 |
Spreadsheet::ParseExcel directly. |
| 20 |
|
| 21 |
BOOK METHODS |
| 22 |
read |
| 23 |
my $xls = Spreadsheet::ParseExcel::Simple->read('spreadsheet.xls'); |
| 24 |
|
| 25 |
This opens the spreadsheet specified for you. Returns undef if we cannot |
| 26 |
read the book. |
| 27 |
|
| 28 |
sheets |
| 29 |
@sheets = $xls->sheets; |
| 30 |
|
| 31 |
Each spreadsheet can contain one or more worksheets. This fetches them |
| 32 |
all back. You can then iterate over them, or jump straight to the one |
| 33 |
you wish to play with. |
| 34 |
|
| 35 |
book |
| 36 |
my $book = $xls->book; |
| 37 |
|
| 38 |
The Spreadsheet::ParseExcel object we are working with. You can use this |
| 39 |
if you need to manipulate it in ways that this interface doesn't allow. |
| 40 |
|
| 41 |
SHEET METHODS |
| 42 |
These methods can be called on each sheet returned from $xls->sheets: |
| 43 |
|
| 44 |
has_data |
| 45 |
if ($sheet->has_data) { ... } |
| 46 |
|
| 47 |
This lets us know if there are more rows in this sheet that we haven't |
| 48 |
read yet. This allows us to differentiate between an empty row, and the |
| 49 |
end of the sheet. |
| 50 |
|
| 51 |
next_row |
| 52 |
my @data = $sheet->next_row; |
| 53 |
|
| 54 |
Fetch the next row of data back. |
| 55 |
|
| 56 |
sheet |
| 57 |
my $obj = $sheet->sheet; |
| 58 |
|
| 59 |
The underlying Spreadsheet::ParseExcel object for the worksheet. You can |
| 60 |
use this if you need to manipulate it in ways that this interface |
| 61 |
doesn't allow (e.g. asking it for the sheet's name). |
| 62 |
|
| 63 |
AUTHOR |
| 64 |
Tony Bowden |
| 65 |
|
| 66 |
BUGS and QUERIES |
| 67 |
Please direct all correspondence regarding this module to: |
| 68 |
[email protected] |
| 69 |
|
| 70 |
COPYRIGHT AND LICENSE |
| 71 |
Copyright (C) 2001-2005 Tony Bowden. |
| 72 |
|
| 73 |
This program is free software; you can redistribute it and/or modify it under |
| 74 |
the terms of the GNU General Public License; either version 2 of the License, |
| 75 |
or (at your option) any later version. |
| 76 |
|
| 77 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 78 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 79 |
FOR A PARTICULAR PURPOSE. |
| 80 |
|
| 81 |
SEE ALSO |
| 82 |
Spreadsheet::ParseExcel. |
| 83 |
|