Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
Rendering html-to-xlsx recipe response from JSReport into a downloadable excel sheet

I have patient data in my databases represented in HTML that I want to print as an excel sheet using JSReport. But when I get the response from the jsreport server with the recipe it reads jibberish and I can't find a way to render it into an excel file.

Dummy example

const axios = require("axios");

const url = "http://localhost:5488/api/report/";

const data = {
  "template": {
      "shortid": "2_Kw0BRuOm",
      "recipe": "html-to-xlsx",
      "data": {
          "people": [
              {
                  "name": "Omar rafat",
                  "age": "20",
                  "job": "Software Engineer"
              }
          ]
      }
  }
}

axios.post(url, {
  "template": {
      "shortid": "2_Kw0BRuOm",
      "recipe": "html-to-xlsx",
      "data": {
          "people": [
              {
                  "name": "Omar rafat",
                  "age": "20",
                  "job": "Software Engineer"
              }
          ]
      },
      "options": { "reports": { "save": true } }
  }
}).then(res => console.log(res.data)).catch(err => console.log(err));

Raw html-to-xlsx response

enter image description here

I might have missed up on the library's usage due to my misunderstanding of how the technology works but I really hope some of you might guide me on the correct implementation of it.

Thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

jsreport has nodejs client you can use https://jsreport.net/learn/nodejs-client

You can check the following example on how to render a template and store the output to the file.

const client = require('jsreport-client')('http://localhost:5488')
const fs = require('fs').promises


async function render () {
  const res = await client.render({
    template: { shortid: '2_Kw0BRuOm' },
    data: { someText: 'world!!' }
  })

  const responseBuffer = await res.body()
  await fs.writeFile('out.xlsx', responseBuffer)
}

render().catch(console.error)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!