Domanda

I have a 2D python List of arbitrary length. I would like to copy this list into an excel worksheet using win32com.

mylist = [["A1","B1","C1","D1"],["A2","B2"],["A3","B3","C3"]]
import win32com.client
from win32com.client import constants as c
excel = win32com.client.Dispatch("Excel.Application")
wb = excel.Workbooks.Add()
ws = wb.Worksheets.Add()

At this point is there something I could do to accomplish my task?

È stato utile?

Soluzione

Use the standard csv module to create a CSV file, which you can then open in Excel.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top