natergj / excel4node

Node module to allow for easy Excel file creation
MIT License
1.38k stars 215 forks source link

excel4node and Azure Functions #346

Open ikochetkov opened 3 years ago

ikochetkov commented 3 years ago

Hi ! Using currently excel4node with expressJS. Sending the object and receiving binary data of excel Want to go away from local server and move it to Azure Functions. Can someone tell is it possible and maybe someone has example how it should looks like?

ikochetkov commented 3 years ago

Adding some details here: So AF using the following synthax to send the data back module.exports = async function (context, req) { try { context.res = { body: "Success!" }; } catch(error) { const err = JSON.stringify(error); context.res = { status: 500, body:Request error. ${err} }; } };

So looks like we can use our method: wb.write('Excel.xlsx', res); but instead res - context.res.

However, this not work. Any suggestions guys how return excel from Azure Functions?