1

I just wanna convert a specific sheet but i dont know how, i've seen information about it but only confuses me, and also i dont think it works the way i want, This is part of the sheet i want to convert to pdf, it is basically a kind of format

Some people just only take the information that they need, using get ranges or something and make a new structure based on the information, that doest works for me, because i need exactly the same as it looks in the sheet, it could be really helpful if someone tells me a way where i can do this.

    function pdf(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var blob = ss.getBlob();
  DriveApp.createFile(blob);
}

This gets me the entire document i tried adding the sheet i want, but it doesnt work, i dont know if tis can be solved easily adding something more to that code, or if its more difficult, every comment is appreciated

  • Try `var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); ` See https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getActiveSheet() – PM 77-1 Jun 29 '22 at 16:08
  • Trying with getActiveSheet, and also getSheetByName, it displays me this error "TypeError: ss.getBlob is not a function" – Clown Aspirant Jun 29 '22 at 16:22
  • May be `getAs(contentType)` that returns a Blob? – PM 77-1 Jun 29 '22 at 16:26
  • You mean like this? `var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var blob = ss.getAs('application/pdf');` – Clown Aspirant Jun 29 '22 at 16:43
  • That was the suggestion, assuming you picked the right content. I have no personal experience with Google Apps. – PM 77-1 Jun 29 '22 at 16:45

0 Answers0