On Fri, 6 Nov 2020 14:15:39 -0500, "Eugen Konkov via RT"
<bug-Spreadsheet-Read@rt.cpan.org> wrote:
Show quoted text> Fri Nov 06 14:15:38 2020: Request 133692 was acted upon.
> Transaction: Ticket created by KES
> Queue: Spreadsheet-Read
> Subject: Values are read incorrect
> Broken in: (no value)
> Severity: (no value)
> Owner: Nobody
> Requestors: KES@cpan.org
> Status: new
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=133692 >
>
>
> I use XLS::Simple which uses Spreadsheet::Read::rows
>
> /home/kes/work/projects/tucha/monkeyman/local/lib/perl5/XLS/Simple.pm
> x63: $x = decode( $opt{charset}, $x );
> 64: }
> 65: } ## end for my $d (@$sheet_data)
> 66:
> x67: return $data;
> 68: }
> 69:
> 70: sub read_xls {
> x71: my ( $xls, %opt ) = @_;
> 72:
> >>73: my $workbook = ReadData($xls);
> 74:
> 75: my @data =
> 76: $opt{only_header}
> x77: ? Spreadsheet::Read::cellrow( $workbook->[1], 1 )
> 78: : Spreadsheet::Read::rows( $workbook->[1] );
> 79:
> x80: shift @data if ( $opt{skip_header} );
> 81:
> x82: return \@data;
>
> Cell value "05" is read as number 5 so read data is not actual.
> If I open file with LibreOffice the "05" value is shown
>
> Is there any flags to read "05" as "05"?
I don't see the problem:
$ cat rt133692.csv
c1,c2,c3
42,"05",18
12,,45
$ csv2xlsx rt133692.csv
Reading rt133692.csv
3 x 3
Writing rt133692.xlsx
$ xlscat rt133692.csv
c1 │ c2 │ c3
42 │ 05 │ 18
12 │ │ 45
3 x 3
$ perl -MDP -MXLS::Simple -wE'DDumper(read_xls("rt133692.xlsx"))'
[
[ 'c1',
'c2',
'c3'
],
[ 42,
'05',
18
],
[ 12,
undef,
45
]
]
So, I probably need a real .xlsx with the data you see.
I *guess*, based on your case, that this is a NUMERIC cell with
number-format '00' or similar applied
--
H.Merijn Brand
https://tux.nl Perl Monger
http://amsterdam.pm.org/
using perl5.00307 .. 5.33 porting perl5 on HP-UX, AIX, and Linux
https://useplaintext.email https://www.test-smoke.org
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/