Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to parse excel files having multiple tables with different number of elements?

by Phenomanan (Monk)
on Oct 12, 2016 at 13:49 UTC ( [id://1173837]=note: print w/replies, xml ) Need Help??


in reply to How to parse excel files having multiple tables with different number of elements?

This was a simple mistake. Look here:

for my $col(0..4) { my $key=$worksheet->get_cell(0,$col)->value; my $cell=$worksheet->get_cell($row,$col); next unless $cell; my $value=$cell->value();

The blank cells in Garry's row are causing the error, meaning that your 'next unless $cell' statement is not skipping the empty cells. Maybe try:

for my $col(0..4) { my $key=$worksheet->get_cell(0,$col)->value; my $cell=$worksheet->get_cell($row,$col); unless($cell){ # Null value } else{ my $value=$cell->value(); ... }

I tested this and it worked for me.

  • Comment on Re: How to parse excel files having multiple tables with different number of elements?
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-20 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found