Well the truth is quite simple, you can make a for to iterate on each element of your database, you must take into account which library you use to manage the connection with your database, in this example use pymysql
:
sql1 = "SELECT 'nombre' 'sexo' 'edad' 'telefono' FROM elnombre_de_tu_tabla"
cursor.execute(sql1)
all = cursor.fetchall() # Aca asignamos a la variable all el resultado
Then you have to add all those values in your application iterating over the elements, usually pymysql returns a dictionary:
indice = 1
for item in all:
hoja['A%s' % indice].value = item['nombre']
hoja['B%s' % indice].value = item['sexo']
hoja['C%s' % indice].value = item['edad']
hoja['D%s' % indice].value = item['telefono']
indice += 1
Your question is very broad but I leave you this little guide, here I leave the pymysql link if you are working with MySQL. Remember to pass the variable cursorclass=pymysql.cursors.DictCursor
in the connector, so that you return the dictionary
link