I'm trying to learn some python and I wanted for python to interact with excel using the win32 module. I found a basic example online on wiki here.
It won't work however. This is the error I get.
Traceback (most recent call last):
File "C:/Users/Greg/Desktop/python programming/excel2.py", line 8, in <module>
sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter))
NameError: name 'Application' is not defined
My question is what does that line DO EXACTLY and why am I getting an error?
sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter))
import win32com.client
from win32com.client import constants as c
excel = win32com.client.Dispatch("Excel.Application")
book = excel.Workbooks.Add()
sheet = book.Worksheets(1)
sheet.Range("A1").Value = "Hello World!"
sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter))
book.SaveAs("c:\simple_example.xls")
sheet = None
book = None
excel.Quit()
excel = None
Thanks sorry if I'm super noob....
Application
object only exists when you do the latter.