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: Intermediate:
Unable assign value from excel sheet cell to a variable

 



suvendra
New User

Jan 8, 2017, 9:10 PM

Post #1 of 2 (897 views)
Unable assign value from excel sheet cell to a variable Can't Post

I want to assign value to the variable expected_cfg_e25ga_config but it is not taking the value from excelsheet from cell 1,1. How to assign the value. Thank you in advance

use strict;
use Spreadsheet::ParseExcel;

my $parser = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse('d:/xyz1.xls');

if ( !defined $workbook ) {
die $parser->error(), ".\n";
}
#my $worksheet = $workbook->worksheet();
for my $worksheet ( $workbook->worksheets() ) {

my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();

foreach my $row ( $row_min .. $row_max ) {
foreach my $col ( $col_min .. $col_max ) {

my $cell = $worksheet->get_cell( $row, $col );
next unless $cell;
print "Row, Col = ($row, $col)\n";
print "Value = ", $cell->value(), "\n";
print "Unformatted = ", $cell->unformatted(), "\n";
print "\n";
print "expected_cfg_e25ga_config =" , $cell->value(1,1) , "\n"

}
}
;
}



Laurent_R
Veteran / Moderator

Jan 8, 2017, 11:09 PM

Post #2 of 2 (894 views)
Re: [suvendra] Unable assign value from excel sheet cell to a variable [In reply to] Can't Post

Do you have this problem only with cell 1,1, or for any cell in the sheet?

Please use code tags for your code samples, itg would make it easier to read.

 
 


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

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