Hi,
I am writing a program that would dump excel contents into CSV file and have problems with Numbers which Excel (2010) stores in IEEE754 format.
All numbers are being dumped as shown below
Data As Appears in Excel:
1.01 HELLO
2.11 1/1/2014
3.21 ONE
4.31 1/1/2014 12:14
5.441 $10
6.241 TWO
77.11 Zulfi
8.11 99
9.11 99.999
10.11 0
Data Dumped into text file by my Python code:
1.01|'HELLO'
2.1099999999999999|'2014-01-01 00:00:00.000000'
3.21|'ONE'
4.3099999999999996|'2014-01-01 12:14:00.000000'
5.4409999999999998|10.0
6.2409999999999997|'TWO'
77.109999999999999|'Zulfi'
8.1099999999999994|99.0
9.1099999999999994|99.998999999999995
10.109999999999999|0.0
The Python's XLRD module is fetching the IEEE754 data it finds for each cell but what I want is what that appears in the Excel sheet. To understand more of what excel is doing I have played with it and inferred that the Excel cell displays only 9 digits of precision i.e If I enter "4.01234567890123" the cell shows only "4.012345679"
To understand more, I have pasted the a list of numbers into two excel columns, the first column is formatted as text and the other as General
Below is the observation:
6.2400000000|6.24
6.2412345678|6.241234568
6.2499999999|6.25
6.2411111111|6.241111111
6.2422222222|6.242222222
6.2433333333|6.243333333
6.2444444444|6.244444444
6.2455555555|6.245555556
6.2466666666|6.246666667
6.2477777777|6.247777778
6.2488888888|6.248888889
6.2499999999|6.25
I am looking for the formula (or a logic that I can place in my Python Code) that would give me the second row by taking the number from first row.
Thanks
Bookmarks