标签:bytes row pre turn query form get osi enum
def download(): out = BytesIO() workbook = xlsxwriter.Workbook(out) table = workbook.add_worksheet() table.write(0, 0, "第1列") table.write(0, 1, "第2列") table.write(0, 2, "第3列") Entitys = Entity.query.all() for index, item in enumerate(Entitys): print(item.to_json()) object = (item.to_json()) row = index + 1 table.write(row, 0, object["name"]) table.write(row, 1, object["sex"]) table.write(row, 2, object["class"]) workbook.close() out.seek(0) filename = quote("Entity类下载.xlsx") rv = send_file(out, as_attachment=True, attachment_filename=filename) rv.headers[‘Content-Disposition‘] += "; filename*=utf-8‘‘{}".format(filename) return rv
标签:flask生成excel并下载。 前台可以一个get链接请求。
标签:bytes row pre turn query form get osi enum
原文地址:https://www.cnblogs.com/renguiyouzhi/p/11874479.html