I am reading an .xls
file using Spreadsheet::ParseExcel and was able to get data as is.
But,when reading an .xlsx
file using Spreadsheet::XLSX, the read values are truncated.
E.g., 2.4578
in .xls
and .xlsx
file is read as 2.4578
and 2.45
开发者_开发技巧, respectively.
Please suggest why .xlsx
file data is corrupted.
I created a simple workbook containing one sheet and only the value 2.4578
in A1
and ran the following script:
use Spreadsheet::XLSX;
my $excel = Spreadsheet::XLSX->new('Book1.xlsx');
my ($sheet) = @{ $excel->{Worksheet} };
print $sheet->{Cells}[0][0]{Val}, "\n";
Output:
C:\Temp> x 2.4578000000000002
So, in this simple case, everything seems to be OK.
If you can post a short, self-contained example that exhibits the problem and a small sample .xlsx
file which we can look at, we would have a better chance of identifying the problem.
Try $cell->{Val}
for the unformatted raw value instead of $cell->Value()
for the Excel formatted value.
精彩评论