DEMO-time!
I had a friend with Windows and some recentish MS-Office create me an xlsx with just one single cell filled with the value 0.9888 and then put that in sandbox/x-0.9888.xlsx
$ perl -Mblib -MDP -MSpreadsheet::Read -we'DDumper ReadData ("sandbox/ +x-0.9888.xlsx")' [ { error => undef, parser => 'Spreadsheet::ParseXLSX', sheet => { Blad1 => 1 }, sheets => 3, type => 'xlsx', version => '0.17' }, { A1 => '0.98880000000000001', attr => [], cell => [ [], [ undef, '0.98880000000000001' ] ], label => 'Blad1', maxcol => 1, maxrow => 1, merged => [] } ] $ env SPREADSHEET_READ_XLSX=Spreadsheet::XLSX perl -Mblib -MDP -MSprea +dsheet::Read -we'DDumper ReadData ("sandbox/x-0.9888.xlsx")' [ { error => undef, parser => 'Spreadsheet::XLSX', sheet => { Blad1 => 1 }, sheets => 3, type => 'xlsx', version => '0.13' }, { A1 => '0.99', attr => [], cell => [ [], [ undef, '0.98880000000000001' ] ], label => 'Blad1', maxcol => 1, maxrow => 1, merged => [] } ] $ env SPREADSHEET_READ_XLSX=Spreadsheet::XLSX::Reader::LibXML perl -Mb +lib -MDP -MSpreadsheet::Read -we'DDumper ReadData ("sandbox/x-0.9888. +xlsx")' XLSX parser cannot parse data: at -e line 1.
I expected that last error: it is the formatter for that module that currently causes integration problems.
I used the development folder, as choosing your own parser is new and not yet released.
This clearly shows the influence of the formatter used in the underlying parser.
I get consistent results for Spreadsheet::ParseXLSX on Linux, AIX and HP-UX. On Windows, I get:
C:\Tmp> perl -MDP -MSpreadsheet::Read -we"DDumper ReadData ('x-0.9888. +xlsx')" [ { error => undef, parser => 'Spreadsheet::ParseXLSX', sheet => { Blad1 => 1 }, sheets => 3, type => 'xlsx', version => '0.17' }, { A1 => '0.9888', attr => [], cell => [ [], [ undef, '0.9888' ] ], label => 'Blad1', maxcol => 1, maxrow => 1, merged => [] } ]
If I unzip the file and then show the stored data:
$ xml_pp < xl/worksheets/sheet1.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <worksheet mc:Ignorable="x14ac" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006 +/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatib +ility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2 +006/relationships" xmlns:x14ac="http://schemas.microsoft.com/office/spreadshee +tml/2009/9/ac"> <dimension ref="A1"/> <sheetViews> <sheetView tabSelected="1" workbookViewId="0"/> </sheetViews> <sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/> <sheetData> <row r="1" spans="1:1" x14ac:dyDescent="0.25"> <c r="A1"> <v>0.98880000000000001</v> </c> </row> </sheetData> <pageMargins bottom="0.75" footer="0.3" header="0.3" left="0.7" righ +t="0.7" top="0.75"/> </worksheet> $
It clearly shows that Excel stored 0.98880000000000001 in the spreadsheet. (For all that now want to blame the formatter, using cat showed the same content, but that would be way too wide a line to neatly show in this forum).
In reply to Re: Spreadsheet::Read module is rounding the decimals in XLSX file
by Tux
in thread Spreadsheet::Read module is rounding the decimals in XLSX file
by char_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |