This can be done using xlwt library, you can install it using pip install xlwt.
import xlwt
headers = ['name', 'family_name', 'age', 'profession']
persons = [["amy", "fisher", 34, "teacher"],
["john", "wayne", 45, "astronaut"]]
# font style
style0 = xlwt.easyxf('font: name Times New Roman, color-index black, bold on')
wb = xlwt.Workbook()
ws = wb.add_sheet('A Test Sheet')
# write headers
for index, value in enumerate(headers):
ws.write(0, index, value, style0)
# write data
for row, person in enumerate(persons):
for index, value in enumerate(person):
ws.write(row+1, index, value)
wb.save('persons.xls')
This will create the excel file you want.