Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spreadsheet::ParseExcel::Simple - find sheet name 1

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

Using the above module,I need to find out the target sheet name out of 4 sheets I have in the given Xcel file.
Would appreciate suggestion how to do it - did not find explanation on the CPAN.
thanks

Long live king Moshiach !
 
From the documentation:
my $obj = $sheet->sheet;
The underlying Spreadsheet::parseExcel object for the worksheet. You can use this if you need to manipulate it in ways that this interface doesn't allow (e.g. asking it for the sheet's name).

So.. in other words you want to do something that the ::Simple module doesn't support and your going to have to do calls to Spreadsheet::parseExcel and if you look at the doc on it you can see how to find the name in the first example.

I personally would just use Speadsheet::parseExcel and ignore the ::Simple module. It is a very common module that is well supported, and you'll get a lot of help on it plus it does everything.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Code:
   use Spreadsheet::ParseExcel;
    my $oExcel = new Spreadsheet::ParseExcel;
    my $oBook = $oExcel->Parse($datafill);
    print "Excel File:", $oBook->{File} , "\n";


    for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) {
        $oWkS = $oBook->{Worksheet}[$iSheet];
        print "$iSheet =>" . "\t" ."$oWkS->{Name}."\n";        
        $iSheet_start= $iSheet if ( $oWkS->{Name} =~m"Start");
        $iSheet_datafill_user_guide= $iSheet if ( $oWkS->{Name} =~m"Datafill");
        $iSheet_datasites= $iSheet if ( $oWkS->{Name} =~m"data sites");
        $iSheet_adce= $iSheet if ($oWkS->{Name} =~m"ADCE");
        $iSheet_mal= $iSheet if ( $oWkS->{Name} =~m"MAL");
        $iSheet_dap= $iSheet if ( $oWkS->{Name} =~m"DAP");
        $iSheet_lcse= $iSheet if ( $oWkS->{Name} =~m"LCSE");	
    }

dmazzini
GSM/UMTS System and Telecomm Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top