Using openpyxl i'm trying to insert a list naming a specific cell. here is my failed attempt
l1 = ["John", 1, 2, 3]
for i in l1:
ws.cell(1,2).append(i)
wb.save("tentavive.xlsx")
Some points about openpyxl append
l1 = ["", "John", 1, 2, 3]
ws.cell(1,2).append(i)
Therefore your code should be;
l1 = ["","John", 1, 2, 3]
ws.append(l1)
wb.save("tentavive.xlsx")
If you used a dictionary instead the same conditions as above apply except you could specify the column for each value to be placed in so its not necessary to pad, if 'John' is to be placed in column B then set the key to 'B'.
d1 = {'B':"John", 'C': 1, 'E': 2, 'F': 3}
ws.append(d1)
wb.save("tentavive.xlsx")
If you do want to specify which row/column to write the values in the list to, then dont use append. Something like this will do the trick
for enum, i in enumerate(l1, 2):
ws.cell(1, enum).value = i
wb.save("tentavive.xlsx")