I use exceljs like this but it returns a error.
TypeError: pipe.write is not a function
and
"message": "Cannot read property 'summary' of undefined"
let workbook = new Excel.Workbook()
let worksheet = workbook.addWorksheet('calogs')
worksheet.columns = [
{header: 'id', key: 'id', width: 5 },
...
]
// Add Array Rows
worksheet.addRows(data)
console.log('XXXXXXXXXXXXXXXXXXXXX',worksheet)
// res is a Stream object???
reply.header(
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
)
reply.header(
'Content-Disposition',
`attachment; filename=` +`calogs.xlsx`
)
return workbook.xlsx.write(reply).then(function() {
reply.status(200).end()
})
how can i fix it?