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 |
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|