Skip to content

Instantly share code, notes, and snippets.

@rheajt
Last active November 16, 2017 01:20
Show Gist options
  • Save rheajt/1a815a848853decf4eb94b463ad8371d to your computer and use it in GitHub Desktop.
Save rheajt/1a815a848853decf4eb94b463ad8371d to your computer and use it in GitHub Desktop.
google apps script to turn docs into pdfs
function getDocs() {
var folderId= '<<PUT YOUR FOLDER ID HERE>>';
var pdfFolder = DriveApp.getFolderById(folderId).createFolder('PDFs');
var files = DriveApp.getFolderById(folderId).getFilesByType(MimeType.GOOGLE_DOCS);
while(files.hasNext()) {
var file = files.next();
var pdf = file.getAs('application/pdf');
pdfFolder.createFile(pdf.copyBlob());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment