There has been some discussion about exporting data from timestore for use in excel, but I wonder if anyone has tried doing a json call from excel to bring the data in. Initial searching seems to indicate you might be able to, but before I raise my hopes too far does anyone know if you can or not?
»
Re: Using json and excel
This turned out to be really simple :)
Couple of questions, I am sure I have read somewhere that there is a limit to the number of data points returned. Have I remembered that correctly, and if so, how do you know how to get the maximum if you are requesting it by UNIX Timestamp (start and end with unknown gap between data points) and then how to request the next batch?
The other query is that, if I do a basic API call to Timestore, I get a result [[1394459145000,10.984908]] which is time and temp (in this case). However, Unix timestamp right now is only 10 digits and this is 13. To convert this I need to remove the right 3 digits. Is there a reason for this of have I missed something? Also, the precision of the temperature seems a bit off as well! :)
I'll post what I have done once I have tidied it up, but as a proof of concept it seems to work.
Re: Using json and excel
Can anyone shed light on the timestamp data format please?
Re: Using json and excel
unixtime in milliseconds. So 1394459145000 equates to Mon, 10 Mar 2014 13:45:45 GMT
Re: Using json and excel
To convert Unix time to excel time format use the following
=(Unixtime/86400)+Date(1970,1,1)
add 1/24 when bst
Re: Using json and excel
Ah Milliseconds - yes that explains it.
Re: Using json and excel
Ok so you want to export data from Timestore to excel? This does it the other way round and gets Excel to pull in the data. Just load these into a module in the VBA, edit as appropriate (you will need an APIkey at least), and off you go.
Remember the dates are in miliseconds in Timestore so the normal Unix Timestamp needs to be multiplied or divided by 1000. I had trouble with overflow so I trimmed the string!
Pretty quick and dirty with no error catching but proves the concept.