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

365
Views
¿Cómo imprimir la tabla en excel en el mismo orden usando la biblioteca XLSX en react js?

** A continuación se muestra el objeto que me gustaría imprimir ** Estoy usando XLSX * Necesito la salida tal como está *

 const handleClick = () => { var wb = XLSX.utils.book_new(); var ws = XLSX.utils.json_to_sheet(arrayofobjects); XLSX.utils.book_append_sheet(wb, ws, 'Test'); XLSX.writeFile(wb, 'file.xlsx');

};

 let arrayofobjects =[ { "00": 4, "01": 6, "10": 12, "11": 7, }, { "00": 7, "01": 7, "10": 4, "11": 5, }

]

Pero obtengo resultados en otro orden en Excel

primero obtengo 10,11 luego obtengo 00,01

Esto es lo que estoy esperando

ingrese la descripción de la imagen aquí

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

0

Lo que te falta es una matriz de encabezado en el orden deseado.

por ejemplo

 // defined array of your headers const header = ["00", "01", "10", "11"] // create workbook as usual const wb = XLSX.utils.book_new(); // here you pass an additional variable called header const ws = XLSX.utils.json_to_sheet( arrayofobjects, {header:header}, //you can also use {header} but for simplicity's sake i left it as is );
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!