On Tue, Dec 30, 2014 at 4:26 PM, Adrian Klaver
<
adrian...@aklaver.com> wrote:
> On 12/30/2014 01:01 PM, John Machin wrote:
>> ORIGINAL: Each cell is set up as a formula (just as though you had typed
>> e.g. ="1234567" into the UI) AND it fills in the value appropriately.
>> This is grossly wasteful of space and CPU cycles compared with a string
>> constant (like you had typed '1234567 into the UI). In any case, xlrd
>> extracts the value happily.
>>
>> SAVED: As above, but the value is set to be a numeric zero, hence xlrd
>> returns numeric zero (xlrd doesn't have a formula evaluator, like LO). I
>> would regard this a a bug in LO; the LO maintainers may have a different
>> view.
>
> I am not understanding.
>
> Where is the value set to 0.0?
>
> If I look in the saved version of the file I still ="744835962453"
Adrian,
You can think of cells as having a "slot" for the formula and another
slot for the naked (fully calculated) value. In all cases, xlrd will
read only the naked value slot. If you see
="744835962453"
then you are looking at a formula, not a value.
Now, when the Excel GUI saves an Excel file, any formula-containing
cells are evaluated and the value slot is populated with the result.
But many (most?) non-Excel programs do no such thing. They will
populate the value slot with 0 (zero).
See XlsxWriter's documentation on its approach to writing formula cells:
https://xlsxwriter.readthedocs.org/worksheet.html#write_formula
Relevant excerpt:
"XlsxWriter doesn’t calculate the value of a formula and instead
stores the value 0 as the formula result. It then sets a global flag
in the XLSX file to say that all formulas and functions should be
recalculated when the file is opened. This is the method recommended
in the Excel documentation and in general it works fine with
spreadsheet applications. However, applications that don’t have a
facility to calculate formulas, such as Excel Viewer, or some mobile
applications will only display the 0 results."
>> By the way, one little piece of mystery is left: The ORIGINAL file
>> last-saved-by is "Calc" i.e. LO or OO, same as the SAVED file ... you
>> may need to dig a little further into the history of the ORIGINAL file.
>
> It is confirmation of an order. I have been trying for years to get the data
> in a non-spreadsheet format so as I do not have deal with all the issues in
> parsing something where the data stays the same but the formatting changes.
By "history", I think John Machin is referring to the purely technical
matter of the modification history of the file. He is saying that the
file is self-reporting as last being saved by LO or OO. Which is to
say that maybe it was in fact last saved by LO or OO, or it could be
that whatever program actually last saved the file has "spoofed" the
signature of LO/OO.
John Y.