I'd like to download a Excel per REST call. If I use Postman to test the endpoint it works fine. But if I start the request on my website the respons is ok but I have no idea how i can change de response to a Excelfile download.
Here is my code:
async export () {
const data = await generateExport()
const blob = new Blob([data], {
type:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
require('downloadjs')(
blob,
'FileName_' +
new Date().toLocaleDateString() +
'.xlsx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
)
}
OR
async export () {
var data = await generateExport()
require('downloadjs')(
data,
'FileName_' +
new Date().toLocaleDateString() +
'.xlsx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
)
}
Thank you for your answer Best wishes