Import Json web data source to xls or csv
hermanmu at gmail.com
Wed Feb 20 02:54:28 CET 2013
First - you can use Python in Excel. http://www.python-excel.org/ or
url = "http://bitcoincharts.com/t/markets.json"
response = urllib.urlopen(url);
data = json.loads(response.read())
f = open("bitcoin.csv","wb")
c = csv.writer(f)
# write headers
c.writerow(["Currency","Symbol","Bid", "Ask", "Volume"])
for d in data:
On Tue, Feb 19, 2013 at 3:48 PM, io <maroso at libero.it> wrote:
> i'm new to python and programming with it and so for json format.
> I have my excel 2010 program with vba that does the following :
> - read the data flow from http://bitcoincharts.com/t/markets.json
> - elaborate it and puts it in excel 2010 for further calculations
> What i'm willing to do is the same using Linux (xubuntu) and libreoffice.
> I thought learning python would be a smart idea for dealing with json
> format as it has a json library/module.
> How do i manage to read the data source from http://bitcoincharts.com/t/
> markets.json and then place it in different cell of a new or existing
> xls worksheet?
> I'm trying some code with SPE but i can't sort the problem and i'm
> receiving many errors.
> I just need currency, symbol, bid, ask, volume
> This is the source code i was trying to use :
> import json
> import csv
> import urllib
> url = "http://bitcoincharts.com/t/markets.json"
> response = urllib.urlopen(url);
> data = json.loads(response.read())
> f = csv.writer(open('file.csv', 'wb+'))
> # use encode to convert non-ASCII characters
> for item in data:
> values = [ x.encode('utf8') for x in item['0'].values() ]
> f.writerow([item['currency'], item['high']] + values)
> Thanks for any help :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list