in reply to Re^2: EXCEL TO HTML Conversion w/Perl
in thread EXCEL TO HTML Conversion w/Perl

This isn't very elegant (and maybe not too efficient), but it will store and extract the data in a way that is usable. I don't do html work, so you are on your own for figuring that part out :)
Note: it assumes that in milestones.xls, all the taskID's are stored in a single cell.

use Spreadsheet::ParseExcel::Simple; my (%milestones, %taskID); my $xls = Spreadsheet::ParseExcel::Simple->read('milestones.xls'); foreach my $sheet ($xls->sheets) { while ($sheet->has_data) { my @data = $sheet->next_row; next if $data[0] =~ m/ID/; next if $data[0] eq ''; my @tasks = split(",", $data[1]); foreach my $task (@tasks) { $milestones{$data[0]} = [ @tasks ]; } } } my $xls = Spreadsheet::ParseExcel::Simple->read('TaskLists.xls'); foreach my $sheet ($xls->sheets) { while ($sheet->has_data) { my @data = $sheet->next_row; next if $data[0] =~ m/ID/; next if $data[0] eq ''; my @tasks = @data[2..3]; $taskID{$data[0]} = [ @tasks ]; } } foreach my $milestone (keys %milestones) { my @tasks = @{ $milestones{$milestone} }; foreach my $task (@tasks) { print "milestone = $milestone, id = $task, start = @{ $taskID{ +$task} }[0], stop = @{ $taskID{$task} }[1]\n"; } } exit;

Replies are listed 'Best First'.
Re^4: EXCEL TO HTML Conversion w/Perl
by ginju (Novice) on Jun 08, 2004 at 01:55 UTC

    Hi David,

    Thank you very much for the code. I will try this out. Your assumption is right. All the TaskID's are in the same single cell comma separated. The HTML part is easy since it is a bunch or print statements. I was stuck with the perl code for extracting the information from the excel work books.

    Thanks a bunch,

    --Wisdom Seeker, Andy