...
cnn.execute(sql)
rec=cnn.fetchall()
strIO = StringIO.StringIO()
strIO.write(excel.make_response_from_array(rec, "xls"))
strIO.seek(0)
return send_file(strIO, mimetype='application/vnd.ms-excel',attachment_filename="result.xls",as_attachment=True)
...
rec=cnn.fetchall()
response = make_response(excel.make_response_from_array(rec, "xls"))
response.headers['Content-Type'] = 'application/vnd.ms-excel'
response.headers['Content-Disposition'] = 'attachment; filename=result.xls'
return response