如何通过应用程序脚本发送 pdf 附件?

问题描述 投票:0回答:0

我想使用应用程序脚本发送 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]'} ) 
      }

有人可以帮助我吗?我怎样才能修复代码以使其正常工作?

google-sheets attachment send
© www.soinside.com 2019 - 2024. All rights reserved.