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

Recommended Answers

All 3 Replies

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

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

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();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.