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

136
Views
for loop está tomando demasiado tiempo y hace que la página se bloquee

Estoy manipulando archivos de Excel usando javascript, estoy convirtiendo el archivo en un objeto json y luego hago un bucle para cada fila. estoy usando este codigo

 document.getElementById('confirm').addEventListener("click", () => { XLSX.utils.json_to_sheet(data, 'out.xlsx'); if (selectedfile && etat == 0) { let fileReader = new FileReader(); fileReader.readAsBinaryString(selectedfile); fileReader.onload = (event) => { etat++; let data = event.target.result; let workbook = XLSX.read(data, { type: "binary" }); console.log(workbook); workbook.SheetNames.forEach(sheet => { let rowObject = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheet],{raw: false}); let ok = JSON.stringify(rowObject, undefined, 4); let tab = JSON.parse(ok); let num = tab.length; console.log(parseInt(num/1000)); for(j = 0;j<parseInt(num/1000)+1;j++){ let row = j *1000; let ligne; if(j == num) ligne = num; else ligne = (j+1)* 1000; let table = []; for(i = row; i<ligne; i++){ let jour = tab[i].JOUR; let date = tab[i].DATE; let compte = tab[i].COMPTE; let code = tab[i].CODE; let libelles = tab[i].LIBELLES; let debit = tab[i].DEBIT ; let creadit = tab[i].CREDIT; let ech = tab[i].ECH; let LETT = tab[i].LETT; table.push( [jour , date,compte , code , libelles , debit , creadit , ech , LETT] ); console.log(i); } } /**/ }); } } } );

El archivo de Excel contiene más de 17k filas, este código toma demasiado tiempo (más de 15 minutos) y provoca bloqueos.

about 4 years ago · Juan Pablo Isaza
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!