G.A.S. code to email a google sheet as a pdf file to a person through Telegram

泄露秘密 提交于 2019-12-13 04:01:29

问题


I use the following Google Script Code to generate a pdf of a google sheet and send it through email. Is there a way I can send the pdf through teleram to a person? How should I change the following code to send the pdf through telegram?

function emailReport() {
  readyForExport();
  var spreadsheet = SpreadsheetApp.getActive();
  var subject = spreadsheet.getRange("U1:U1").getValues();
  var emailTo = spreadsheet.getRange("V1:V1").getValues();
  var message = spreadsheet.getRange("W1:W1").getValues();
  var fileName = spreadsheet.getRange("X1:X1").getValues();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName("Students"));
  var pdf = DriveApp.getFileById(spreadsheet.getId()).getAs('application/pdf').getBytes();
  var attach = {fileName:fileName[0][0],content:pdf, mimeType:'application/pdf'};
  MailApp.sendEmail(emailTo, subject, message, {attachments:[attach]});
};

来源:https://stackoverflow.com/questions/50941647/g-a-s-code-to-email-a-google-sheet-as-a-pdf-file-to-a-person-through-telegram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!