How do you create a tabular data structure form this list of sublists using GSpread or XLWT in which every item at index 0 is in the first column, every item at index 1 is in the second column, etc.?
For example, I'd like to put all the a's in the following list into column1, all the b's into column2, etc. In other words, I only want one value to one cell, so I'd like 'a' in the first cell in the first column, 'aa1' in the second cell of the first column, 'aa2' in the third cell of the first column, etc.
lst = [[['a','b','c'],['aa1','bb1','cc1'],['aaa2','bbb2','ccc2']],[['a','b','c'],['aa1','bb1','cc1'],['aaa2','bbb2','ccc2']]]
This is what I have, which is using a for-loop, but I'm wondering if there is a different method where I could create one for loop that way I wouldn't have to manually create a for loop for every extra column.
gc = gspread.login('username', 'password')
sheet = gc.open("Curalate").sheet1
row = 1
for subsublist in lst[0]:
sheet.update_cell(1,row,subsublist[0])
row = row + 1
row = 1
for subsublist in lst[0]:
sheet.update_cell(2,row,subsublist[1])
row = row + 1
row = 1
for subsublist in lst[0]:
sheet.update_cell(,row,subsublist[2])
row = row + 13
also, if this were xlwt, it's exactly the same except sheet.udpate_cell would be replaced with sheet.write and it's organized sheet.write(row,column,datapoint) instead of (column, row, datapoint).