django excel xlwt

前端 未结 6 665
醉梦人生
醉梦人生 2020-12-02 08:15

On a django site, I want to generate an excel file based on some data in the database.

I\'m thinking of using xlwt, but it only has a method to save the data to a fi

6条回答
  •  误落风尘
    2020-12-02 08:45

    You can save your XLS file to a StringIO object, which is file-like.

    You can return the StringIO object's getvalue() in the response. Be sure to add headers to mark it as a downloadable spreadsheet.

提交回复
热议问题