The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Spreadsheet::ParseExcel - Get information from Excel file

SYNOPSIS

    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);
            }
        }
    }

DESCRIPTION

Spreadsheet::ParseExcel makes you to get information from Excel95, Excel97, Excel2000 file.

Functions

new

$oExcel = new Spreadsheet::ParseExcel;

Constructor.

Parse

$oWorkbook = $oParse->Parse($sFileName [, $oFmt]);

return Workbook object. if error occurs, returns undef.

$sFileName

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.

$oFmt

"Formatter Class" to format the value of cells.

Workbook

Spreadsheet::ParseExcel::Workbook

Workbook class has these properties :

File

Name of the file

Author

Author of the file

Flag1904

If this flag is on, date of the file count from 1904.

Version

Version of the file

SheetCount

Numbers of Worksheet s in that Workbook

Worksheet[SheetNo]

Array of Worksheets class

Worksheet

Spreadsheet::ParseExcel::Worksheet

Worksheet class has these properties:

Name

Name of that Worksheet

DefRowHeight

Default height of rows

DefColWidth

Default width of columns

RowHeight[Row]

Array of row height

ColHeight[Col]

Array of column width (undef means DefColWidth)

Cells[Row][Col]

Array of Cells infomation in the worksheet

Cell

Spreadsheet::ParseExcel::Cell

Cell class has these properties:

Value

Method Formatted value of that cell

Val

Original Value of that cell

Type

Kind of that cell ('Text', 'Numeric', 'Date')

Code

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.

Formatter class

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:

ChkType($oSelf, $iNumeric, $iFmtIdx)

tells type of the cell that has specified value.

$oSelf

Formatter itself

$iNumeric

If on, the value seems to be number

$iFmtIdx

Format index number of that cell

TextFmt($oSelf, $sText, $sCode)

converts original text into applicatable for Value.

$oSelf

Formatter itself

$sText

Original text

$sCode

Character code of Original text

ValFmt($oSelf, $oCell, $oBook)

converts original value into applicatable for Value.

$oSelf

Formatter itself

$oCell

Cell object

$oBook

Workbook object

AUTHOR

Kawai Takanori (Hippo2000) kwitknr@cpan.org

    http://member.nifty.ne.jp/hippo2000/            (Japanese)
    http://member.nifty.ne.jp/hippo2000/index_e.htm (English)

SEE ALSO

XLHTML, OLE::Storage, Spreadsheet::WriteExcel, OLE::Storage_Lite

This module is based on herbert within OLE::Storage and XLHTML.

COPYRIGHT

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.

ACKNOWLEDGEMENTS

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:

Around line 32:

Unknown directive: =cmmnt

Around line 865:

Unknown directive: =cmmt