package handler import ( "github.com/360EntSecGroup-Skylar/excelize" "github.com/gin-gonic/gin" ) func DownloadExcel(c *gin.Context){ xlsx := excelize.NewFile() xlsx.SetCellValue("Sheet1", "A2", "asdas") //_ = xlsx.SaveAs("./aaa.xlsx") c.Header("Content-Type", "application/octet-stream") c.Header("Content-Disposition", "attachment; filename="+"Workbook.xlsx") c.Header("Content-Transfer-Encoding", "binary") _ = xlsx.Write(c.Writer) }