I am using the python code below to extract some values from an excel spreadsheet and then push them to an html page for further processing. I would like to modify the code below so that I can add additional values against each task, any help
the code below does spit out the following:
{'line items': {'AMS Upgrade': '30667', 'BMS works': '35722'}}
How can I revise the code below so that I can add 2 more values against each task i.e. AMS Upgrade and BMS works and get the likes of (note the structure below could be wrong)
{'line items': {'AMS Upgrade': {'30667','100%', '25799'}},{'BMS works': {'10667','10%', '3572'}} }
Code:
book = xlrd.open_workbook("Example - supporting doc.xls") first_sheet = book.sheet_by_index(-1) nested_dict = {} nested_dict["line items"] = {}for i in range(21,175):
Line_items = first_sheet.row_slice(rowx=i, start_colx=2, end_colx=8)if str(Line_items[0].value) and str(Line_items[1].value): if not Line_items[5].value ==0 : nested_dict["line items"].update({str(Line_items[0].value) : str(Line_items[1].value)})
print nested_dict
print json.dumps(nested_dict)
*** as requested see excel extract below
#python