CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Error in using Spreadsheet::ParseExcel::SaveParser

 



mar85
Novice

Feb 18, 2013, 6:59 PM

Post #1 of 4 (843 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:

Code
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


Rahul6990
Novice

Feb 18, 2013, 10:29 PM

Post #2 of 4 (830 views)
Re: [mar85] Error in using Spreadsheet::ParseExcel::SaveParser [In reply to] Can't Post

Hi mar85,

I am just making a guess but the error message is showing that the error is in below module :

Spreadsheet::ParseExcel::SaveParser::Workbook

and in the question you specified that you are using :

Spreadsheet::ParseExcel::SaveParser

both of them are different modules.


mar85
Novice

Feb 18, 2013, 10:49 PM

Post #3 of 4 (829 views)
Re: [Rahul6990] Error in using Spreadsheet::ParseExcel::SaveParser [In reply to] Can't Post

Thanks Rahul for the reply,
http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spreadsheet/ParseExcel/SaveParser/Workbook.pm

According to the link above, Spreadsheet::ParseExcel::SaveParser::Workbook is a class inside Spreadsheet::ParseExcel::SaveParser
I think there's no problem from that side. Should be something else that triggers the error. Correct me if I'm wrong.


wickedxter
User

Feb 19, 2013, 5:38 PM

Post #4 of 4 (818 views)
Re: [mar85] Error in using Spreadsheet::ParseExcel::SaveParser [In reply to] Can't Post

include this module


Code
use Spreadsheet::ParseExcel::Workbook;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives