in reply to How to dump a webpage content into a excel
This how the spreadsheet part could look like:
use strict; use warnings; use HTML::TableExtract; use Spreadsheet::WriteExcel; my $filename = "table.xls"; my $workbook = Spreadsheet::WriteExcel->new($filename); my $response; { local $/ = undef; $response = <DATA>; } 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++; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to dump a webpage content into a excel
by ghosh123 (Monk) on Apr 23, 2013 at 09:52 UTC | |
by hdb (Monsignor) on Apr 23, 2013 at 10:16 UTC | |
by ghosh123 (Monk) on Apr 23, 2013 at 11:09 UTC |
In Section
Seekers of Perl Wisdom