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

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by mitchems
0

Can Somebody tell me how to read cells of excel sheet using perl

0

Try this for excel

#!/usr/bin/perl -w

use strict;
use Spreadsheet::Read;
use Data::Dumper;

my $xls = ReadData ("Input/sample.xls");

print $xls->[1]{'A1'};
exit;

Regards,
Balaji S

0
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();
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.