Hi, I have an microsoft excel sheet that I want to parse data by using Spreadsheet::ParseExcel. Basically the following code, I specify what min/max row and min/max col to retreive data from and prints out the results. However, I do not know where to go from now to print the results into a html table.
use strict;
use Spreadsheet::ParseExcel;
my $BookObject = Spreadsheet::ParseExcel::Workbook->Parse("testbook.xl
+s");
foreach my $WorksheetObject (@{$BookObject->{Worksheet}}) {
for(my $RowIndex = '0'; # starting at minimu+m row value
defined $WorksheetObject->{MaxRow} &&
$RowIndex <= '7'; # ending at maximum +row value
$RowIndex++) {
for (my $ColumnIndex = '0';
defined $WorksheetObject->{MaxCol} &&
$ColumnIndex <= '2';
$ColumnIndex++) {
my $CellObject = $WorksheetObject->{Cells}[$RowIndex][$Colum
+nIndex]; # get cell
#print "($RowIndex, $ColumnIndex)",
print $CellObject->Value, "\n" if ($CellObject);
}
}
}
The above code prints out the data extracted.
Sales B3 B4 Low Power Components 5000000 460000 Virtual Wire Products
+27000 23000 Filter Products 45000 3700000 Frequency Control Modules 1
+0000 7000 Technology Developments 10000 2000 Total Sales 113000 11500
+0
So now I need that data it prints out to be in a HTML table that looks like this:
| Sales |
Q3 |
Q4 |
| Low Power Components |
3000000 |
4600000 |
| Virtual Wire Products |
2700000 |
2300000 |
| Filter Products |
4500000 |
3700000 |
| Frequency Control
Modules |
1000000 |
700000 |
| Technology Developments |
100000 |
200000 |
|
|
|
| Total Sales |
11300000 |
11500000 |
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.