Hello Monks

I'm creating an XLS spreadsheet on a Linux server using Spreadsheet::WriteExcel. It has 12 worksheets and each sheet has different color combinations and URL hyperlinks.

Now I need to convert it to HTML to display it on a webpage. I can do this manually without issue, but when I tried to use Spreadsheet::ParseExcel to automate the process (borrowed from an old monk post) I ended up with an extremely basic display

my $excel_obj = Spreadsheet::ParseExcel->new(); my $workbook = $excel_obj->Parse($outfile); die "Workbook did not return worksheets!\n" unless ref $workbook->{Worksheet} eq 'ARRAY'; for my $worksheet ( @{$workbook->{Worksheet}} ) { print OUT_HTML_FILE "<table>\n"; for my $row ( 0 .. $worksheet->{MaxRow} ) { print OUT_HTML_FILE "<tr>\n"; for my $col ( 0 .. $worksheet->{MaxCol} ) { my $cell = $worksheet->{Cells}[$row][$col]; print OUT_HTML_FILE "<td>"; print OUT_HTML_FILE ref $cell ? $cell->Value : ''; print OUT_HTML_FILE "</td>\n"; } print OUT_HTML_FILE "</tr>\n"; # record ends } print OUT_HTML_FILE "</table>\n"; # worksheet ends }

When I look at the files that Excel produces when I use the "Save As" to an HTML file. It produces a main .htm file plus a link to 12 separate htm files for each worksheet. Within each sheet the HTML seems to be somewhat complex. Can you please let me know if Spreadsheet::ParseExcel would be a good option to try and produce the same .htm files that are produced from the "File Save As" option within Excel?

Thank you very much for your time


In reply to Converting XLS to HTML by dirtdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.