我想将当前活动工作表(仅工作表)的范围A1:I13导出为PDF,然后通过电子邮件发送,但是遇到了这个错误
range.getAs 不是函数
function generateAndEmailPDF() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A1:I13");
var pdfBlob = range.getAs('application/pdf').setName('timesheet.pdf').setPageOrientation(DocumentApp.Orientation.LANDSCAPE);
var recipient = "[email protected]";
var subject = "PDF Test";
var body = "Please find attached a PDF generated from the current sheet.";
MailApp.sendEmail(recipient, subject, body, {attachments: [pdfBlob]});
}
我将工作表编辑为仅包含该特定范围内的数据,然后使用 sheet.getAs 重新尝试。还是行不通。合并单元格 A1:A2 并在单元格内包含适合的 PNG 图像。关于如何修复此错误的任何指示?期待谢谢!