我正在尝试使用以下脚本将Google表格文档中的第一张表格发送为PDF格式的电子邮件。要发送到的电子邮件在单元格A1中列出。
但是,此脚本将整个电子表格发送为PDF,而不仅仅是第一张。我一直在尝试使用来自stackoverflow的其他一些脚本,但这是唯一实际发送电子邮件的脚本。
希望你们能帮助我。
/* Email Google Spreadsheet as PDF */
function emailGoogleSpreadsheetAsPDF() {
// Send the PDF of the spreadsheet to this email address
var email = "amit@labnol.org";
// Get the currently active spreadsheet URL (link)
var ss = SpreadsheetApp.getActiveSpreadsheet();
// Subject of email message
var subject = "PDF generated from spreadsheet " + ss.getName();
// Email Body can be HTML too
var body = "Install the <a href='http://www.labnol.org/email-sheet'>Email Spreadsheet add-on</a> for one-click conversion.";
var blob = DriveApp.getFileById(ss.getId()).getAs("application/pdf");
blob.setName(ss.getName() + …Run Code Online (Sandbox Code Playgroud)