generating a CSV file online on Google App Engine

前端 未结 3 1585
甜味超标
甜味超标 2021-02-09 22:36

I am using Google App Engine (python), I want my users to be able to download a CSV file generated using some data from the datastore (but I don\'t want them to download the who

3条回答
  •  离开以前
    2021-02-09 23:28

    I found a way to use the CSV module on GAE! Here it is:

    self.response.headers['Content-Type'] = 'application/csv'
    writer = csv.writer(self.response.out)
    
    writer.writerow(["foo", "foo,bar", "bar"])
    

    This way you don't need to write any files

提交回复
热议问题