Spreadsheet::ParseExcel - Get information from Excel file
use strict; use Spreadsheet::ParseExcel; my $oExcel = new Spreadsheet::ParseExcel; #1.1 Normal Excel97 my $oBook = $oExcel->Parse('Excel/Test97.xls'); my($iR, $iC, $oWkS, $oWkC); print "FILE :", $oBook->{File} , "\n"; print "COUNT :", $oBook->{SheetCount} , "\n"; print "AUTHOR:", $oBook->{Author} , "\n"; for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { $oWkS = $oBook->{Worksheet}[$iSheet]; print "--------- SHEET:", $oWkS->{Name}, "\n"; for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC); } } }
Spreadsheet::ParseExcel makes you to get information from Excel95, Excel97, Excel2000 file.
$oExcel = new Spreadsheet::ParseExcel;
Constructor.
$oWorkbook = $oParse->Parse($sFileName [, $oFmt]);
return Workbook object. if error occurs, returns undef.
name of the file to parse
From 0.12 (with OLE::Storage_Lite v.0.06), scalar reference of file contents (ex. \$sBuff) or IO::Handle object (inclucdng IO::File etc.) are also available.
"Formatter Class" to format the value of cells.
Spreadsheet::ParseExcel::Workbook
Workbook class has these properties :
Name of the file
Author of the file
If this flag is on, date of the file count from 1904.
Version of the file
Numbers of Worksheet s in that Workbook
Array of Worksheets class
Spreadsheet::ParseExcel::Worksheet
Worksheet class has these properties:
Name of that Worksheet
Default height of rows
Default width of columns
Array of row height
Array of column width (undef means DefColWidth)
Array of Cells infomation in the worksheet
Spreadsheet::ParseExcel::Cell
Cell class has these properties:
Method Formatted value of that cell
Original Value of that cell
Kind of that cell ('Text', 'Numeric', 'Date')
Character code of that cell (undef, 'ucs2', '_native_') undef tells that cell seems to be ascii. '_native_' tells that cell seems to be 'sjis' or something like that.
Spreadsheet::ParseExcel::Fmt*
Formatter class will convert cell data.
Spreadsheet::ParseExcel includes 2 formatter classes: FmtDefault and FmtJapanese. You can create your own FmtClass as you like.
Formatter class(Spreadsheet::ParseExcel::Fmt*) should provide these functions:
tells type of the cell that has specified value.
Formatter itself
If on, the value seems to be number
Format index number of that cell
converts original text into applicatable for Value.
Original text
Character code of Original text
converts original value into applicatable for Value.
Cell object
Workbook object
This module can not get the values of fomulas in Excel files made with Spreadsheet::WriteExcel. Normaly (ie. By Excel application), formula has the result with it. But Spreadsheet::WriteExcel writes formula with no result. If you set your Excel application "Auto Calculation" off. (maybe [Tool]-[Option]-[Calculation] or something) You will see the same result.
Kawai Takanori (Hippo2000) kwitknr@cpan.org
http://member.nifty.ne.jp/hippo2000/ (Japanese) http://member.nifty.ne.jp/hippo2000/index_e.htm (English)
XLHTML, OLE::Storage, Spreadsheet::WriteExcel, OLE::Storage_Lite
This module is based on herbert within OLE::Storage and XLHTML.
The Spreadsheet::ParseExcel module is Copyright (c) 2000,2001 Kawai Takanori. Japan. All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
First of all, I would like to acknowledge valuable program and modules : XHTML, OLE::Storage and Spreadsheet::WriteExcel.
In no particular order: Yamaji Haruna, Simamoto Takesi, Noguchi Harumi, Ikezawa Kazuhiro, Suwazono Shugo, Hirofumi Morisada, Michael Edwards, Kim Namusk and many many people + Kawai Mikako.
2 POD Errors
The following errors were encountered while parsing the POD:
Unknown directive: =cmmnt
Unknown directive: =cmmt
To install Spreadsheet::ParseExcel::Workbook, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spreadsheet::ParseExcel::Workbook
CPAN shell
perl -MCPAN -e shell install Spreadsheet::ParseExcel::Workbook
For more information on module installation, please visit the detailed CPAN module installation guide.