| | |
How to call a excel sheet from perl
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2009
Posts: 9
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Apr 2009
Posts: 2
Reputation:
Solved Threads: 0
Try this for excel
Regards,
Balaji S
Perl Syntax (Toggle Plain Text)
#!/usr/bin/perl -w use strict; use Spreadsheet::Read; use Data::Dumper; my $xls = ReadData ("Input/sample.xls"); print $xls->[1]{'A1'}; exit;
Balaji S
Last edited by Ancient Dragon; Apr 30th, 2009 at 9:11 pm. Reason: add code tags
Perl Syntax (Toggle Plain Text)
use OLE; use Win32::OLE::Const 'Microsoft Excel'; my($xapp) = CreateObject OLE 'Excel.Application' || die $!; $xapp->{'Visible'} = 1; # Open the excel file $wkb = $xapp->Workbooks->Open('filename'); if ( ! $wkb ) { print "Can't open filename\n"; exit; } $wks = $wkb->Worksheets("Sheet1"); #what ever the sheet name $wks->Cells(1,1)->{'Value'} = 'whatever'; #assign to 'whatever' $val=$wks->Cells(1,1)->{'Value'}; #which reads from cell 1,1 and answers the next questioner $wkb->SaveAs({Filename => 'newfile'}); $wkb->Close(); $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
Larry Wall
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
Other Threads in the Perl Forum
- Previous Thread: How to convert text file to binary file and Binary to text using perl
- Next Thread: Why doesn't this work? (filehandling+regexp)
| Thread Tools | Search this Thread |





