in reply to Re^3: How to dump a webpage content into a excel
in thread How to dump a webpage content into a excel
Hi
Yes , I commented out the add_worksheet line inside the foreach loop and created only one worksheet before the for each loop (please see below).
Also, iterating the $nrow++ one more time after the $ts->rows foreach. Please correct me .
my $worksheet = $workbook->add_worksheet("Table"); my $te = HTML::TableExtract->new( keep_html => 0 ); $te->parse($response); my $counter; foreach my $ts ($te->tables) { # my $worksheet = $workbook->add_worksheet("Table ".$counter++); my $nrow=0; foreach my $row ($ts->rows) { my $ncol=0; foreach my $col (@$row) { $worksheet->write($nrow,$ncol++,$col) if defined $col; } $nrow++; } $nrow++; }
|
|---|