Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

331
Vistas
Google Apps Script How to google spreadsheet to Excel (xlsx)

I would like to convert the Google Spread Sheet created using Google Apps Script into an Excel (xlsx) file and send it as an attachment through Gmail (MailApp).

I used the code below, but there is an error, so please check it.

Exception: Converting from application/vnd.google-apps.spreadsheet to application/vnd.openxmlformats-officedocument.spreadsheetml.sheet is not supported.

    //send email
    var emailTitle = noteSheet.getRange(2,2).getValue();
    var emailContent = noteSheet.getRange(3,2).getValue();
    var emailRecipient = noteSheet.getRange(4,2).getValue();
    var emailCarboncopy = noteSheet.getRange(5,2).getValue();

    var paymentfileName = paymentSheet.getRange(2,2).getValue();
    var paymentXlsx = DriveApp.getFilesByName(paymentfileName);
    if  (!paymentXlsx.hasNext()) {
      throw new Error("No paymentXlsx file.");
    }
    var paymentXlsx = paymentXlsx.next();

    MailApp.sendEmail(emailRecipient, emailTitle, emailContent, {
      name: 'name',
      cc: emailCarboncopy,
      attachments: [paymentXlsx.getAs(MimeType.MICROSOFT_EXCEL)]
    }); 
    }
almost 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda