First - you can use Python in Excel. <a href="http://www.python-excel.org/">http://www.python-excel.org/</a> or <a href="https://www.datanitro.com/">https://www.datanitro.com/</a><div><br></div><div>Updated code:</div><div>
<br></div><div><div>import json</div><div>import urllib</div><div>import csv</div><div><br></div><div>url = "<a href="http://bitcoincharts.com/t/markets.json">http://bitcoincharts.com/t/markets.json</a>"</div><div>
response = urllib.urlopen(url);</div><div>data = json.loads(response.read())</div><div><br></div><div>f = open("bitcoin.csv","wb")</div><div>c = csv.writer(f)</div><div><br></div><div># write headers</div>
<div>c.writerow(["Currency","Symbol","Bid", "Ask", "Volume"])</div><div><br></div><div><br></div><div>for d in data:</div><div> c.writerow([str(d["currency"]),str(d["symbol"]),str(d["bid"]),str(d["ask"]),str(d["currency_volume"])])</div>
<div><br></div><div><br></div><br><div class="gmail_quote">On Tue, Feb 19, 2013 at 3:48 PM, io <span dir="ltr"><<a href="mailto:maroso@libero.it" target="_blank">maroso@libero.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
i'm new to python and programming with it and so for json format.<br>
I have my excel 2010 program with vba that does the following :<br>
<br>
- read the data flow from <a href="http://bitcoincharts.com/t/markets.json" target="_blank">http://bitcoincharts.com/t/markets.json</a><br>
- elaborate it and puts it in excel 2010 for further calculations<br>
<br>
What i'm willing to do is the same using Linux (xubuntu) and libreoffice.<br>
<br>
I thought learning python would be a smart idea for dealing with json<br>
format as it has a json library/module.<br>
<br>
How do i manage to read the data source from <a href="http://bitcoincharts.com/t/" target="_blank">http://bitcoincharts.com/t/</a><br>
markets.json and then place it in different cell of a new or existing<br>
xls worksheet?<br>
<br>
I'm trying some code with SPE but i can't sort the problem and i'm<br>
receiving many errors.<br>
<br>
I just need currency, symbol, bid, ask, volume<br>
This is the source code i was trying to use :<br>
<br>
<br>
import json<br>
import csv<br>
import urllib<br>
<br>
url = "<a href="http://bitcoincharts.com/t/markets.json" target="_blank">http://bitcoincharts.com/t/markets.json</a>"<br>
response = urllib.urlopen(url);<br>
data = json.loads(response.read())<br>
<br>
f = csv.writer(open('file.csv', 'wb+'))<br>
# use encode to convert non-ASCII characters<br>
for item in data:<br>
values = [ x.encode('utf8') for x in item['0'].values() ]<br>
f.writerow([item['currency'], item['high']] + values)<br>
<br>
<br>
<br>
Thanks for any help :-)<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div>