1

I am looking to update my already created Excel worksheet with Json data coming from a browser. The current code generates a new worksheet everytime i run the program.

import requests
import json
import urllib
import xlwt

url = raw_input("Enter url:-")
res = urllib.urlopen(url)
data = res.read()

data1 = json.loads(data)

book = xlwt.Workbook(encoding="utf-8") 
sheet1 = book.add_sheet("AssetsReport0")

colunm_count = 0
for title, value in data1.iteritems():
    sheet1.write(0, colunm_count, title)
    sheet1.write(1, colunm_count, value)
    colunm_count += 1

file_name = "test1.xls"%()
book.save(file_name)

What is the best way i could do this?

Tauseef Hussain
  • 1,049
  • 4
  • 15
  • 29
  • this link http://stackoverflow.com/questions/2725852/writing-to-existing-workbook-using-xlwt says that you have to copy the existing file, write data on it, and resave this copy. – user2707389 May 18 '15 at 16:10

0 Answers0