How to call a excel sheet from perl

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2009
Posts: 9
Reputation: rana03 is an unknown quantity at this point 
Solved Threads: 0
rana03 rana03 is offline Offline
Newbie Poster

How to call a excel sheet from perl

 
0
  #1
Apr 28th, 2009
Hi,

I am working on a assignment where I have results sheet which is in form of text file;
I want text file content to be written in excel sheet; generally we manually copy and paste the results in excel sheet.
Our existing excel sheet has 70(sub-sheets) e.g result of test case A will paste in sheet A, like tat result of B will go in sheet B and so on...
Now i want to know is there any way by which we can call a excel sheet through Perl and can add the result at specific location.

Any help is appreciated;

Regards,
rAnA
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 9
Reputation: rana03 is an unknown quantity at this point 
Solved Threads: 0
rana03 rana03 is offline Offline
Newbie Poster

Re: How to call a excel sheet from perl

 
0
  #2
Apr 30th, 2009
Can Somebody tell me how to read cells of excel sheet using perl
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 2
Reputation: soubalaji is an unknown quantity at this point 
Solved Threads: 0
soubalaji soubalaji is offline Offline
Newbie Poster

Re: How to call a excel sheet from perl

 
0
  #3
Apr 30th, 2009
Try this for excel
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use Spreadsheet::Read;
  5. use Data::Dumper;
  6.  
  7. my $xls = ReadData ("Input/sample.xls");
  8.  
  9. print $xls->[1]{'A1'};
  10. exit;
Regards,
Balaji S
Last edited by Ancient Dragon; Apr 30th, 2009 at 9:11 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 57
Reputation: mitchems is an unknown quantity at this point 
Solved Threads: 2
mitchems's Avatar
mitchems mitchems is offline Offline
Junior Poster in Training

Re: How to call a excel sheet from perl

 
0
  #4
May 1st, 2009
  1. use OLE;
  2. use Win32::OLE::Const 'Microsoft Excel';
  3. my($xapp) = CreateObject OLE 'Excel.Application' || die $!;
  4. $xapp->{'Visible'} = 1;
  5.  
  6. # Open the excel file
  7. $wkb = $xapp->Workbooks->Open('filename');
  8. if ( ! $wkb )
  9. { print "Can't open filename\n"; exit; }
  10. $wks = $wkb->Worksheets("Sheet1"); #what ever the sheet name
  11. $wks->Cells(1,1)->{'Value'} = 'whatever'; #assign to 'whatever'
  12.  
  13. $val=$wks->Cells(1,1)->{'Value'}; #which reads from cell 1,1 and answers the next questioner
  14. $wkb->SaveAs({Filename => 'newfile'});
  15. $wkb->Close();
  16. $xapp->Quit();
Last edited by mitchems; May 1st, 2009 at 12:09 pm.
And don't tell me there isn't one bit of difference between null and space, because that's exactly how much difference there is.

Larry Wall
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Perl Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC