-
-
Save rcknr/93c8fdd88dc9cf90a4628c847d24fc95 to your computer and use it in GitHub Desktop.
Get Google Spreadsheet as PDF with customizations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function spreadsheetToPDF(key) { | |
var spreadsheet = SpreadsheetApp.openById(key); | |
var response = UrlFetchApp.fetch(spreadsheet.getUrl() + '/export?exportFormat=pdf&gid=1&gridlines=0&printtitle=0&size=7&fzr=true&portrait=1&fitw=1', { | |
muteHttpExceptions: true, | |
headers: { | |
Authorization: 'Bearer ' + ScriptApp.getOAuthToken(), | |
} | |
}); | |
return response.getBlob(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment