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.
Owner: |
jmcnamara [...] cpan.org
|
Requestors: |
eva [...] multimap.com
peca110 [...] yahoo.se
|
Cc: |
|
AdminCc: |
|
|
Severity: |
Normal |
Broken in: |
2.12 |
Fixed in: |
(no value)
|
exceller.pl
exceller.xls
exceller2.pl
|
Fri Feb 03 10:27:36 2006
Guest - Ticket created
Excel doesn't seem to calculate the value in
$wks->write( 1, 4, "=COUNTIF(A:A,B3)" );
However, if I open the output file exceller.xls and press enter in the
formula bar for cell E2, Excel then calculates the value.
This seems to be an issue with my version of Excel - on Excel:Mac v.X
the code/output works as expected.
version info:
GNU/Linux 2.6.9-1.667smp
perl, v5.8.5 built for i686-linux
Excel: 2003
Message body not shown because it is not plain text.
use utf8;
use strict;
use warnings;
use Spreadsheet::WriteExcel;
my $outfile = "exceller.xls";
my $wbk = Spreadsheet::WriteExcel->new( $outfile );
my $wks = $wbk->add_worksheet( 'Test' );
my $row = 1;
for(my $i =0; $i < 11; $i++) {
$wks->write( $row, 0, $i );
$row++;
}
$wks->write( 1, 2, "=COUNT(A:A)" );
$wks->write( 1, 3, "=COUNTIF(A:A,5)" );
$wks->write( 2, 1, "5" );
$wks->write( 1, 4, "=COUNTIF(A:A,B3)" );
$wks->activate;
$wbk->close;
Fri Feb 03 11:01:47 2006
jmcnamara [...] cpan.org - Taken
Sun Feb 05 12:56:38 2006
Guest - Correspondence added
On Fri Feb 03 10:27:36 2006, guest wrote:
Show quoted text> Excel doesn't seem to calculate the value in
> $wks->write( 1, 4, "=COUNTIF(A:A,B3)" );
This is a known bug in the formula parser. It will be fixed in a future
release. In the meantime you can work around it using store_formula and
repeat_formula. Like this:
# Workaround for formula parsing problem.
my $countif = $wks->store_formula('=COUNTIF(A:A,B3)');
$wks->repeat_formula(1, 5, $countif, undef, '_ref2d' => '_ref2dV');
See the attached file.
John.
--
use utf8;
use strict;
use warnings;
use Spreadsheet::WriteExcel;
my $outfile = "exceller.xls";
my $wbk = Spreadsheet::WriteExcel->new( $outfile );
my $wks = $wbk->add_worksheet( 'Test' );
my $row = 1;
for(my $i =0; $i < 11; $i++) {
$wks->write( $row, 0, $i );
$row++;
}
$wks->write( 1, 2, "=COUNT(A:A)" );
$wks->write( 1, 3, "=COUNTIF(A:A,5)" );
$wks->write( 2, 1, "5" );
$wks->write( 1, 4, "=COUNTIF(A:A,B3)" );
# Workaround for formula parsing problem.
my $countif = $wks->store_formula('=COUNTIF(A:A,B3)');
$wks->repeat_formula(1, 5, $countif, undef, '_ref2d' => '_ref2dV');
$wks->activate;
$wbk->close;
Sun Feb 05 12:56:40 2006
The RT System itself - Status changed from 'new' to 'open'
Thu May 10 23:18:02 2007
peca110 [...] yahoo.se - Ticket #27076: Ticket created
Hi,
The COUNTIF Excel function permits references in both the first and second argument. References in the first argument works fine, both I can't get references in the second argument to work.
Below is a code example that generates an excel file with this content
Hi =COUNTIF(A:A,"Hi")
Hi =COUNTIF(A:A,B3)
Hi Hi
The first formula returns the expected result 3 (there are three "Hi" in column A), but the second one returns 0. If you instead enter the second formula directly in Excel it returns 3. It's actually enough to just press F2 to open the cell for editing and then press Return, then the 0 becomes 3.
I use Perl version 5.8.1 and Spreadsheet-WriteExcel version 2.10 (but the fault also exist in 2.18, I tried).
Here is the code example:
#!/app/perl/5.8.1/bin/perl
use strict;
use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new("example.xls");
my $worksheet = $workbook->add_worksheet();
# Write "Hi" three times in the first column.
$worksheet->write(0, 0, "Hi");
$worksheet->write(1, 0, "Hi");
$worksheet->write(2, 0, "Hi");
# Count the number of "Hi"s in the first column.
# The first formula works and gives the expected result 3.
# The second one returns the incorrect result 0.
$worksheet->write(0, 1, '=COUNTIF(A:A,"Hi")');
$worksheet->write(1, 1, '=COUNTIF(A:A,B2)');
$worksheet->write(2, 1, "Hi");
Best regards, Per Calson
---------------------------------
Hitta din nästa resa på Yahoo! Shopping.
Jämför pris på flygbiljetter och hotellrum:
http://shopping.yahoo.se/b/a/c_169901_resor_biljetter.html
Fri May 11 04:55:28 2007
jmcnamara [...] cpan.org - Ticket #27076: Correspondence added
On Thu May 10 23:18:02 2007, peca110@yahoo.se wrote:
Show quoted text> Hi,
>
> The COUNTIF Excel function permits references in both the first and
> second argument.
Hi,
This is a known issue but the fix is non-trivial.
There is already a bug open against this with a suggested workaround.
https://rt.cpan.org/Public/Bug/Display.html?id=17465
I will merge this into the other issue.
John.
--
Fri May 11 04:55:31 2007
The RT System itself - Ticket #27076: Status changed from 'new' to 'open'
Fri May 11 05:38:17 2007
jmcnamara [...] cpan.org - Ticket #27076: Merged into ticket #17465
Fri May 11 05:38:18 2007
jmcnamara [...] cpan.org - Merged into ticket #17465
Fri May 11 05:38:18 2007
jmcnamara [...] cpan.org - Subject changed from 'COUNTIF not calculating value' to 'references in second argument to COUNTIF doesn't work'
Wed Nov 21 18:51:45 2012
jmcnamara [...] cpan.org - Correspondence added
Closing this issue. Can't fix.
Suggest using Excel::Writer::XLSX instead.
Wed Nov 21 18:51:47 2012
jmcnamara [...] cpan.org - Status changed from 'open' to 'resolved'