0

I put together a script to turn a google sheet into a pdf and email at the click of a button. Instead of just sending the front page, it is capturing all of the back end data as well leaving me with multiple page pdfs rather than the one front page I want.

Here is what I have right now.

function sendrequest() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var recipientsheet = ss.getSheetByName("ref")
  var recipients = recipientsheet.getRange("I2:I3")
  var pdfsheet = ss.getSheetByName("request_form")
  var date = pdfsheet.getRange("B8")

    var message = {
    to: "ryan@email.com" ,
    subject: "Inventory Movement Request" ,
    body: "New Inventory Movement Request",
    name: " ",
    attachments: [ss.getAs(MimeType.PDF).setName("Movement Request")]
  }
  MailApp.sendEmail(message);
  • 1
    Welcome to [so]. Short answer because `attachments: [ss.getAs(MimeType.PDF).setName("Movement Request")]` converts the whole spreadsheet to PDF. If you need further help, please add a brief description of your search efforts as is suggested in [ask]. – Rubén May 07 '21 at 15:25
  • 1
    I think that [this search](https://stackoverflow.com/search?q=%5Bgoogle-apps-script%5D%5Bgoogle-sheets%5D+single+sheet+pdf) will help you to find helpful Q/As. – Rubén May 07 '21 at 15:27
  • 1
    In my perspective this is the easiest [solution](https://stackoverflow.com/questions/63413712/can-no-longer-produce-pdf-from-google-sheets-spreadsheet-for-some-of-the-users). Using UrlFetchApp to convert specific sheet into a blob – Ron M May 07 '21 at 15:38

0 Answers0