In the spreadsheet app itself, you have the options to print only a specific sheet. You also can turn off the grid lines when creating the pdf from within the app. Is ther
this is a solution
var blob = DriveApp.getFileById(idsheet).getAs("application/pdf");
blob.setName("name".pdf");
var dossier = DriveApp.getFolderById("0Bx71KaTqXxQPQUYyVEVyYkJ0bEU");
dossier.createFile(blob);
I simply hide the sheets that I don't want put in the pdf
When you choose export to pdf, you get a messagebox with options. In the right side of this messagebox there are five checkboxes. Check the second one, then you will hide the gridlines in the export. I don't know the label of this checkbox, because I use another language than english.
Good luck!
- Robert
Google apps script to create a pdf of a specific sheet of a spreadsheet.
function generatePdf() {
var originalSpreadsheet = SpreadsheetApp.getActive();
var sourcesheet = originalSpreadsheet.getSheetByName("Sheet - Name");
var sourcerange = sourcesheet.getRange('A1:G7'); // range to get - here I get all of columns which i want
var sourcevalues = sourcerange.getValues();
var data = sourcesheet.getDataRange().getValues();
var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export"); // can give any name.
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var projectname = SpreadsheetApp.getActiveSpreadsheet();
var sheet = sourcesheet.copyTo(newSpreadsheet);
var destrange = sheet.getRange('A1:G7');
destrange.setValues(sourcevalues);
newSpreadsheet.getSheetByName('Sheet1').activate();
newSpreadsheet.deleteActiveSheet();
var pdf = DriveApp.getFileById(newSpreadsheet.getId());
var theBlob = pdf.getBlob().getAs('application/pdf').setName("name");
var folderID = "Folder Id"; // Folder id to save in a folder.
var folder = DriveApp.getFolderById(folderID);
var newFile = folder.createFile(theBlob);
DriveApp.getFileById(newSpreadsheet.getId()).setTrashed(true);
}
@rcknr, worked for me, more options below. (From: http://productforums.google.com/forum/#!msg/apps-script/wQvCF6yY1Qk/R0uyVmf-Xx0J )
URL like this: https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=tOHm3f8tdIxf7tSZzWvBGiA&gid=0&size=legal&fitw=true&gridlines=false&portrait=false&exportFormat=pdf
other settings
fmcmd=12
size=legal/A4
fzr=true/false
portrait=false/true
fitw=true/false
gid=0/1/2
gridlines=false/true
printtitle=false/true
sheetnames=false/true
pagenum=UNDEFINED
attachment=false/true
true/false where sometimes required, I could not use 0/1 instead.
Unfortunately this currently isn't possible with Apps Script, but you can file a feature request on our issue tracker.