Reading in cells from excel that are formated
#1
Posted 31 August 2012 - 07:42 PM
But now I am pulling in data from an excel sheet and the data im looking at is time. For example the time in the sheet says 1:00:00 PM, but since this is set to a time format, this is not its actual value. If you change the cell from time to "general" the value changes to 0.58777777 (or something like that)
Does anyone have any experience with this? What I would really like to do is simply change the 1:00:00 PM to military time (So this would be 13:00), but by changing the format options, this only changes the way the cells are seen, but not the value that autoit pulls.
Thanks!
-Wesley
#2
Posted 31 August 2012 - 08:15 PM
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#3
Posted 31 August 2012 - 08:25 PM
#include <Excel.au3> Global $oXLC_Excel = _ExcelBookOpen("test.xls") Local $aArray = _ExcelReadSheetToArray($oXLC_Excel) ; $Cell = $aArray[2][5] MsgBox(0, "Cell", $Cell)
Thanks for your quick response!
#4
Posted 31 August 2012 - 08:28 PM
I would suggest to create your own function "_ExcelReadSheetToArrayText" using a copy of "_ExcelReadSheetToArray" and replace ".Value" with ".Text".
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#5
Posted 31 August 2012 - 08:38 PM
Now if I pull out these values as text, and I for example take out two numbers 13:00 and 12:00 and I strip out the 13 and 12 and tried to subtract them will this cause issues if they are not considered integers?
Thanks!
#6
Posted 31 August 2012 - 08:40 PM
Check this:
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#7
Posted 01 September 2012 - 12:54 PM
That seemed to work!
Basically you have, if I remember correctly:
- Value = actual value. For a time, 0..1.
- Text = formatted result. Here, 13:05:23 fx
- Formula = the actual formula that produced the value.
Now if I pull out these values as text, and I for example take out two numbers 13:00 and 12:00 and I strip out the 13 and 12 and tried to subtract them will this cause issues if they are not considered integers?
You could just as easily have subtracted 0.6 from 0.5 and used the 0.1 to caculate to 10% of 24 hours. That's what Excel does internally. But see above also.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




