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

363
Views
Cómo editar y guardar archivos de Excel en el servidor fstp

Cuando trato de editar el archivo de Excel y cargarlo en el servidor, escribe el archivo pero cuando intento abrirlo aparece un mensaje de error "Encontramos un problema con algún contenido .xlsx error"

 const uploadAttachment = async (arrayAttach) => { try { let sftp = new Client(); await sftp.connect(config) const promises = arrayAttach.map(async attachment => { const workbook = new Excel.Workbook(); await workbook.xlsx.load(attachment.buffer); workbook.worksheets[0].name = 'sheet1'; const buffer = await workbook.xlsx.writeBuffer(); sftp.put(buffer, `test/${attachment.originalname}.xlsx`); }); Promise.all(promises) .then(results => { console.log('all files have been uploaded'); }) .catch(e => { logger.error(e) console.error(e); }); } catch (err) { logger.error(err) console.log(err); } }

Mensaje de error

Pero si subo el archivo al servidor sin editarlo lo hago bien, adjunto un código de muestra

 const uploadAttachmentOld = async (arrayAttach) => { try { let sftp = new Client(); await sftp.connect(config) const promises = arrayAttach.map(async attachment => { logger.info(attachment) sftp.put(attachment.buffer, `test/${attachment.originalname}.xlsx`); }); Promise.all(promises) .then(results => { console.log('all files have been uploaded'); }) .catch(e => { console.error(e); }); } catch (err) { console.log(err); } }

Me encantaría si alguien pudiera ayudarme a entender dónde está mi error.

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!