I am trying to access a relative file(which I need to put there accessible to Lambda) So that I could change the content of that file and send the response as part of API gateway response.
I am able to generate an entirely new .xlsx file and send to the client. But the requirement is to change the content of given .xls (from filesystem relative path).
let XlsxPopulate = require('xlsx-populate');
exports.handler = async (event, ctx, cb) => {
XlsxPopulate.fromFileAsync('./sample.xlsx')
.then(workbook => {
//.... Modfy content
return {
statusCode: 200,
headers: {
'access-control-allow-origin': '*',
},
body: modifiedWorkbook,
isBase64Encoded: true
}
});
};