def exportCSV = Action {
    val data = "data 1, data 2"
      Ok(data).withHeaders(
          CONTENT_TYPE -> "text/csv",
          CONTENT_DISPOSITION -> "attachment; filename=foo.csv"
      )
  }
This method only suitable if you have small amount of data. If not, I would recommend using streaming.
 
No comments:
Post a Comment