I am new to Python. I've successfully connected to my SQL database via an odbc connection and I am pulling data from a table. How do I then get that data into a Excel workbook. Preferably using the xlsxwriter module.
import pyodbc
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=SQLSERVER;PORT=XX;DATABASE=dbname;UID=sa;PWD=##')
cursor = cnxn.cursor()
cursor.execute("select * from T1 where C2 not like '%text%'")
for row in cursor:
print row.1, row.2, row3
cursor.close()
cnxn.close()