I am trying to take data from a database and put it in an excel spreadsheet.
##################################
EXAMPLE OF OUTPUT
I have tried:
ws['A1']=job[0]
ws['A1']=joblist[0] #After appending an empty joblist[]
I could use a point in the right direction...
##################################
with connection.cursor() as cursor: # Select a record sql = "SELECT DISTINCT JobID FROM tblDTTicket WHERE Ticket_Date = '2020-03-24'" cursor.execute(sql) jobs = cursor.fetchall() joblist.append(cursor.execute(sql)) for job in jobs: print(job) finally: connection.close()#####################
EXAMPLE OF OUTPUT
Output:{'JobID': 'STOCK7'}
{'JobID': 'STOCK2'}
{'JobID': 'STOCK5'}
I keep trying to assign the data to a cell, I am using openpyxl and trying to pass even one of these three pieces of data to a cell. I have tried:
ws['A1']=job[0]
ws['A1']=joblist[0] #After appending an empty joblist[]
I could use a point in the right direction...