http://www.perlmonks.org?node_id=1005413

czechtraveller has asked for the wisdom of the Perl Monks concerning the following question:

The problem was in the autofilter() function

I use Perl 5.12.4 so not sure what to do to make the xlsx support autofilter method. They claim it is not fully supported.

Have you ever received this error?
Can't locate object method "_quote_sheetname" via package "Excel::Writ +er::XLSX::Worksheet" at C:/Perl/lib/Excel/Writer/XLSX/Worksheet.pm li +ne 987.
I checked my code 100x times and still cannot see what would be the source of this problem. My program should print out 3 sheets in a file but gets stuck before the 2nd sheet.
my $workbook = Excel::Writer::XLSX->new($xlsfile); # Add a worksheet my $worksheet = $workbook->add_worksheet( 'Inputs'); my $format1 = $workbook->add_format( %font_basic ); ......... my $worksheet2 = $workbook->add_worksheet('Results');
If I update their code then it complains about this method: $workbook->close();

I appreciate your help.

Mike

Replies are listed 'Best First'.
Re: xlsx _quote_sheetname
by 2teez (Vicar) on Nov 24, 2012 at 19:34 UTC

    Hi czechtraveller,

    • First of, I think you have to re-format your post, see How do I post a question effectively?
    • Check through your code, and reformatting. I have this:
      use warnings; use strict; use Excel::Writer::XLSX; my $xlsfile = 'Excel in 2007.xlsx'; my $workbook = Excel::Writer::XLSX->new($xlsfile); # Add a worksheet my $worksheet = $workbook->add_worksheet('Inputs'); my %font_basic; # add your format parameters my $format1 = $workbook->add_format(%font_basic); my $worksheet2 = $workbook->add_worksheet('Results'); $workbook->close();
      Which work fine for me, with no error message.
      I think you need check again for where a method like this _quote_sheetname is been used on Excel::Writer::XLSX::Worksheet in your script
    • You can as well check Excel::Writer::XLSX::Examples for Excel::Writer::XLSX usage.
    • Update:
      "..The problem was in the autofilter() function...what to do to make the xlsx support autofilter method.."
      Why is that? I don't think you have to write your own autofilter method. Autofilter is supported in that module.
      Check this: Example: Autofilter
      Except, you have something else in mind.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me