I am trying to write lists into excel, the list contains a couple of columns.
I have included my code below. It seems to only extract the first value. I am fairly new to python, what am I missing?
Code:
import win32com.client as win32
#
Z = [3,4,6,8,9,11,40]
Q = ['x','y','z','e','g','AA','BB']
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Add()
ws = wb.Worksheets.Add()
ws.Name = "MyNewSheet"
ws.Range(ws.Cells(1,1),ws.Cells(1,2)).Value = ['Z','Q']
for i,e in enumerate (Z):
ws.Range("A2:A8").Value = [ i for i in (Z)]
for i,e in enumerate (Z):
ws.Range("B2:B8").Value = [ i for i in (Q)]
wb.SaveAs('beta.xlsx')
excel.Application.Quit()