Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How to convert Excel contents into a hash table and further access the contents of that hash table ?

by shadowsong (Pilgrim)
on Oct 05, 2016 at 15:08 UTC ( #1173349=note: print w/replies, xml ) Need Help??


in reply to How to convert Excel contents into a hash table and further access the contents of that hash table ?

Hi ankit.tayal560,

You need to break up your get_cell subroutine calls to avoid processing blank cells i.e. change every instance of:

$key_var = $worksheet->get_cell($x,$y)->value

to something like

$cell = $worksheet->get_cell($x,$y); next unless $cell; $key_var = $cell->value;

Additionally, I would change for my $row(1..$worksheet->row_range) to for my $row(1..($worksheet->row_range)[1]) - the row_range subroutine returns a list, not a scalar

I hope that helps, good luck!
Shadowsong

  • Comment on Re: How to convert Excel contents into a hash table and further access the contents of that hash table ?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: How to convert Excel contents into a hash table and further access the contents of that hash table ?
by ankit.tayal560 (Beadle) on Oct 06, 2016 at 10:16 UTC

    thanks for the guidance. it did work! thanks again

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1173349]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2019-07-17 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?