我目前正在嘗試每天使用Google應用程序腳本通過電子郵件發送Google表格,我想將我的表單文檔上的特定選項卡/工作表轉換爲HTML並填充電子郵件正文。到目前爲止,我已經拿出了下面的代碼,但不幸的是,它發送的PDF格式的電子郵件不足以作爲我的問題的解決方案。我感謝我能得到的所有幫助。將Google表格轉換爲HTML並使用Google應用程序腳本將其作爲電子郵件發送
function sendEmailWithAttachments() {
var fileId = 'Sheet id';
// Send an email with an attachment: a file from Google Drive (as a PDF)
var file = DriveApp.getFileById(fileId);
MailApp.sendEmail('Email', 'file name',
'One File IS Attached.', {
name: 'Subject',
attachments: [file.getAs(MimeType.PDF), ]
});
MailApp.sendEmail('email2', 'file name',
'One File IS Attached.', {
name: 'subject',
attachments: [file.getAs(MimeType.PDF), ]
});
}
您必須使用SpreadsheetApp獲取值(並可能需要格式化)並自行創建HTML內容。 –