0

I am trying to send an email automatically via Google Sheets with an attachment such as XLSX or Sheets version but I cannot. I have the following error message:

Exception: Converting from application/pdf to application/vnd.google-apps.spreadsheet is not supported. SendAttachment @ Send Email.gs:9

function sendReport() {
  var message = {
    to: "youremail@example.com",
    subject: "Monthly sales report",
    body: "Hi team,\n\nPlease find the monthly report attached.\n\nThank you,\nBob",
    name: "Bob",
    attachments: [SpreadsheetApp.getActiveSpreadsheet().getAs(MimeType.GOOGLE_SHEETS).setName("Monthly sales report")]
  }
  MailApp.sendEmail(message);
}

Also, is this possible to choose which cell will be show on the attachment ? I don't know how to do this.

Thank you for your help,

Have a nice day :)

Flowpo
  • 1
  • Does this answer your question? [Converting Google Spreadsheet to Excel with AppScript and send it via email](https://stackoverflow.com/questions/32356863/converting-google-spreadsheet-to-excel-with-appscript-and-send-it-via-email) – idfurw Sep 08 '21 at 10:31

0 Answers0