vendredi 27 février 2015

VBA Offsett in Python

I would like to add the returns of a json to excel cell by cell, like



2003-1 2003-2 2003-3 2003-4 2003-5 2003-6 2003-7 2003-8 2003-9 ....
number number number number number number number number number ....


Here is my code, but as can be understood it only pastes to the first cell, I could not construct the system I wanted. Thank you in advance..



from xlwings import Workbook, Sheet, Range, Chart
import requests
import json

payload = {'cityId':3969, 'lbDistricts':599, 'criter':149,'startdate':'2003-01','cmd':'result','areaCode':18439}
url = "http://ift.tt/1MUARz5"
r = requests.post(url, data=payload)

wb = Workbook()
data = json.loads(r.text)
data = map(dict.values, data[u'output'][u'resultset'][u'record'][u'data'])
for row in data:



Range("A1").value = '{:10}{:10}'.format(*row)

Aucun commentaire:

Enregistrer un commentaire