
mar85
Novice
Feb 18, 2013, 6:59 PM
Post #1 of 4
(166 views)
|
|
Error in using Spreadsheet::ParseExcel::SaveParser
|
Can't Post
|
|
Hello, I've problem related to the use of this perl module/fuction: Spreadsheet::ParseExcel::SaveParser Here is the script that I'm studying:
use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; #use Spreadsheet::WriteExcel; ################################################################################ # Description: Perl script example for opening and modifying excel spread-sheet ################################################################################ # Open existing spread-sheet with SaveParser my $read_excel = Spreadsheet::ParseExcel::SaveParser->new(); my $excel_data = $read_excel->Parse('Example.xls'); # Get the first worksheet my $sheet1 = $excel_data->worksheet('Sheet1'); # Get the same format from original cells to be used for writing new data my $original_cell1 = $sheet1->get_cell(3,1); my $format_number1 = $original_cell1->{FormatNo1}; # Append new data into original worksheet $sheet1->AddCell(3, 2, 'ww8.1', $format_number1); # Write over existing file or write a new file $excel_data->SaveAs('ModifiedExcel.Practice.xls'); When I run the script, I got this error message: Can't locate object method "worksheet" via package "Spreadsheet::ParseExcel::SaveParser::Workbook" at WriteExcel.ParseExcel_SaveParser_Example.pl line 19. Line 19 in the script is this command line: my $sheet1 = $excel_data->worksheet('Sheet1'); Is the use of the perl functions/modules are correct in this case? I'm trying to write a perl script which can open an existing excel spreadsheet and add/append data in it. Thanks
|