nuovo / spreadsheet-reader

A PHP spreadsheet reader (Excel XLS and XLSX, OpenOffice ODS, and variously separated text files) with a singular goal of getting the data out, efficiently
http://www.nuovo.lv/
Other
674 stars 498 forks source link

SpreadsheetReader_XLSX incorrectly detecting data type #123

Open scottmcdwork opened 7 years ago

scottmcdwork commented 7 years ago

This is a great project! Still by far the fasted I found importing Excel data. So, a few tweaks is totally worth it in my opinion. Data type issue: I am importing data containing leading and training zeros that must be maintained. Some items (intermittent) stored like this in the xml returned as an integer with a value of INF. I did not find any special characters in the data. <c r="L4053" s="10" t="inlineStr"><is><t>3E00X05</t></is></c>

Others like this lost the leading and trailing zeros: <c r="L4203" s="10" t="inlineStr"><is><t>00.10</t></is>

It appears the improper data type detection is happening in the FormatData function. I did do a quick test in "spout" and it returned the data correctly in case you want to leverage how it was done in that git project.

In my case I didn't really have any need for anything other than strings in my data, so I added a tweak to next() function to just return the cell value as "$Value" so it was returned as a string.

Thanks.

libraries.zip