Today I requested that Excel::Writer::XLSX::Workbook should provide a method "activesheet" which should return the worksheet object of the current active worksheet.

The reason for this is that you only can add formats on workbook level but you might need it when you only have the worksheet.

In my case, where I want to put database data into an excel file, I would need to pass both objects, workbook and worksheet, to my subroutines or need to create a new object or work with globals. So I thought: The workbook object already knows the current active worksheet, so why not pass only the workbook? Unfortunately it knows the active worksheet, but won't tell you (unless you access its internal data).

This is what I put now into my app to get around this dilemma:

package Excel::Writer::XLSX::Workbook; sub activesheet { my($self) = @_; return $self->{'_worksheets'}->[ $self->{'_activesheet'} ]; }

I then created a pull request for this enhancement, but the author does not want to add this method unless more people request it.

So my question is: Do you also think this method is useful? Would you mind then asking for it?

Note: I'm not complaining that he did not want to include just upon my request. I also don't want you to go and request it, just because I asked for it. Just do it if you really think it's useful. Or maybe tell me why you think it's stupid. ;) I have no problem extending Excel::Writer::XLSX::Workbook the way I do it now.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

In reply to Excel::Writer::XLSX -> get the active sheet by Skeeve

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.