I'd like to push contents from the string to xls contents are
abc,[1,2],abc/er/t_y,def,[3,4],def/er/t_d,ghi,ghi/tr/t_p,jkl,[5],jkl/tr/t_m_n,nop,nop/tr/t_k
this is my sample code (using xlwt)
workbook = xlwt.Workbook()
sh = workbook.add_sheet("Sheet1")
def exporttoexcel ():
print("I am in print excel")
rowCount = 1
for row in finalvalue: # in finalvalue abc,[1,2],abc/er/ty.. is stored as type= str
colCount = 0
for column in row.split(","):
sh.write(rowCount, colCount, column)
colCount += 1
rowCount += 1
workbook.save("myxl.xls")
exporttoexcel()
while ingesting data in excel there are few rules to follow
- column headers are main,ids,UI
- each cell have one value except ids [ids may or may not be there]
- after three columns it should move to the next row
- the second column i.e **id** should have only ids and if not available it should be kept as blank
how to push data into excel which looks similar to this with the above rules?
| A | B | C |
1|main|ids|UI|
2|abc |1,2|abc/tr/t_y|
3|def |3,4|def/tr/t_d|
4|ghi | |ghi/tr/t_p|
5|jkl |5 |jkl/tr/t_m_n|
6|nop | |nop/tr/t_k|