0
const xlsx = require("xlsx");
const requestretry = require("requestretry");
let response = await requestretry({
      url: "https://dummy.com/filename",
      json: false,
      headers: { Authorization: token },
      maxAttempts: 5,   
      retryDelay: 5000,  
      retryStrategy: requestretry.RetryStrategies.HTTPOrNetworkError
    })
    const workbook = xlsx.read(response.body, { type: "buffer" });
    exceldata = await xlsx.utils.sheet_to_json(
      workbook.Sheets[workbook.SheetNames[0]], { range: 4, raw: false })
    console.log(exceldata);// didn't get my excel data

when I use Postman's Send button to call that external api I receive a unicode chracters in respose tab enter image description here

But when I use Postman's Send and Download button to call that external api I can get the xlsx file to save. enter image description here

Now, I am able to replicate same unicode as in I am receiving with Postman's Send button in my NodeJS code using requestretry module but don't know what to do next. enter image description here I thought its a buffer and tried xlsx.read(response.body, { type: "buffer" }) but got wrong output. enter image description here

xlsx file enter image description here

0 Answers0