Skip Menu |

This queue is for tickets about the Spreadsheet-WriteExcel CPAN distribution.

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::WriteExcel here are some pointers

1) State the issues as clearly and as concisely as possible. A simple program or Excel test file (see below) will often explain the issue better than a lot of text.

2) Provide information on your system, version of perl and module versions. The following program will generate everything that is required. Put this information in your bug report.

    #!/usr/bin/perl -w

    print "\n    Perl version   : $]";
    print "\n    OS name        : $^O";
    print "\n    Module versions: (not all are required)\n";

    my @modules = qw(
                      Spreadsheet::WriteExcel
                      Parse::RecDescent
                      File::Temp
                      OLE::Storage_Lite
                      IO::Stringy
                      Spreadsheet::ParseExcel
                      Scalar::Util
                      Unicode::Map
                    );

    for my $module (@modules) {
        my $version;
        eval "require $module";

        if (not $@) {
            $version = $module->VERSION;
            $version = '(unknown)' if not defined $version;
        }
        else {
            $version = '(not installed)';
        }

        printf "%21s%-24s\t%s\n", "", $module, $version;
    }

    __END__

3) Upgrade to the latest version of Spreadsheet::WriteExcel (or at least test on a system with an upgraded version). The issue you are reporting may already have been fixed.

4) Create a small but complete example program that demonstrates your problem. The program should be as small as possible. At the same time it should be a complete program that generates an Excel file. If the Spreadsheet::WriteExcel section is part of a much larger program then simplify it down to the essentials. Simulate any DB reads with an array.

5) Say if you tested with Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

6) If you are submitting a patch you should check with the author whether the issue has already been patched or if a fix is in the works. Patches should be accompanied by test cases.

Asking a question

If you would like to ask a more general question there is the Spreadsheet::WriteExcel Google Group.

Report information
The Basics
Id: 112448
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcel

People
Owner: Nobody in particular
Requestors: davidegx [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Cannot add chart if the worksheet name contains parenthesis
Date: Fri, 26 Feb 2016 11:21:58 +0100
To: bug-Spreadsheet-WriteExcel [...] rt.cpan.org
From: David EG <davidegx [...] gmail.com>
Hi, ** Problem ** $chart->add_series dies saying "Unknown defined name test in formula at bar.pl line 13." when I try to use a worksheet name that contains brackets. Normally, I can generate the file with worksheet names like "test (this)" and that works fine. The problem appears when I try to use a chart. ** Example program ** use strict; use warnings; use Spreadsheet::WriteExcel; my $name = 'test (this)'; my $workbook = Spreadsheet::WriteExcel->new( 'chart.xls' ); my $worksheet = $workbook->add_worksheet($name); my $chart = $workbook->add_chart( type => 'bar' ); $chart->add_series( categories => "=$name" . '!$A$2:$A$7', values => "=$name" . '!$B$2:$B$7', ); my $data = [ [ 'Category', 2, 3, 4, 5, 6, 7 ], [ 'Value', 1, 4, 5, 2, 1, 5 ], ]; $worksheet->write( 'A1', $data ); ** System info ** Perl version : 5.020002 OS name : linux Module versions: (not all are required) Spreadsheet::WriteExcel 2.40 Parse::RecDescent 1.967009 File::Temp 0.2304 OLE::Storage_Lite 0.19 IO::Stringy 2.110 Spreadsheet::ParseExcel (not installed) Scalar::Util 1.38 Unicode::Map (not installed) Best Regards, David EG
Hi, Excel requires that worksheet names with spaces are quoted in formulas and the chart ranges is such a case. So changing the add_series to the following will fix the issue: $chart->add_series( categories => "='$name'" . '!$A$2:$A$7', values => "='$name'" . '!$B$2:$B$7', ); See also the xl_range_formula() function which should handle the quoting for you: http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel/Chart.pm#Working_with_Cell_Ranges Finally, Spreadsheet::WriteExcel is now deprecated in favour of Excel::Writer::XLSX: http://search.cpan.org/dist/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm#Migrating_to_Excel::Writer::XLSX It wouldn't have fixed this issue but chart support is greatly improved. John