我想使用应用程序脚本发送 pdf 附件。
我想从 GoogleSheet 获取文件路径 -> 然后获取文件 ID -> 然后获取附件 -> 然后通过应用脚本发送它。
不幸的是我的代码不起作用(获取 currentAttachmentID 不起作用)
我有以下代码:
const currentAttachmentLink = ss.getRange(i, 21).getValue(); // https://drive.google.com/file/d/fileid/view?usp=sharing
const currentAttachmentID = getFileIdFromUrl(currentAttachmentLink)
const attachment = DriveApp.getFileById(currentAttachmentLink)
。 。 .
GmailApp.sendEmail(currentEmail, // wyslij maila
emailTitle,
"" ,
{ htmlBody: htmlForEmail,
attachments: [attachment],
from: '[email protected]'} )
}
有人可以帮助我吗?我怎样才能修复代码以使其正常工作?