'trying to export both columns and rows to excel for a query like , select * from customer where customer_id=2323234

I'm trying to print both columns and rows for select query-ex:

select * from customer where customer_id=2323234


for r, row in enumerate(cursor.fetchall()):
    for c, col in enumerate(row):
        sheet.write(r, c, col)

the above logic is writing only row but not column or headers into excel

to export both rows and columns to excel from python.
My DB is Oracle.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source