[Google Apps Script] Send email with an attachment

Created on November 30, 2026

Pass an array of attachments in attachments, in the fourth argument to MailApp.sendEmail(). This example reads a file from Google Drive and attaches its blob. Replace the file ID and address before running it.

function main() {
  const file = DriveApp.getFileById("YOUR_FILE_ID");
  MailApp.sendEmail("tom@example.com", "Meeting notes", "See the attachment.", {
    attachments: [file.getBlob()],
  });
}
Google Apps Script