First off, neither Excel::Template nor Spreadsheet::WriteExcel will parse, just like Spreadsheet::ParseExcel will not write. And, because they have very different purposes, they were not built to work together. (Now, it doesn't mean that they cannot. There is a module on CPAN that will read and write to the same spreadsheet ... kinda - it reads and then overwrites.)

Now, Excel::Template, like its name suggests, builds XLS files from a template in a file and a data structure in memory. You use the template for the look'n'feel and the data structure for the data, like HTML::Template. (It was built to be a helper to HTML::Template.)

If I understand the real problem you're attempting to solve, you have a workbook that you need to provide to some end users. That workbook has a bunch of data and the like that needs to go into a given layout. Your workbook will always have N columns, but the specific data in B5 (or whatever) will change. (Maybe, one day it's "Chicago" and the next day it's "New York".)

This is the perfect place for a template. It requires rethinking your approach. But, it's doable.

Now ... taking the XML from Spreadsheet::ParseExcel and creating a template ... that would be problematic. Here's the issue - Excel::Template is actually misnamed - it should really be called Excel::Layout. Templating is only the smaller part of what it does - it really does the layout for an XLS.

The long and short of this is that I would have no way of determining that the first 10 rows belong to the CITIES loop and the second 10 rows belong to the STATES loop. The layout is something provided by a human, as is the data structure. The module should stick to what it does and get good at that.

A parse-string method would certainly be helpful. I'll put that in the next release. Thanks!

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re3: Modifying an Excel doc (UNIX) by dragonchild
in thread Modifying an Excel doc (UNIX) by dpmott

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.