SHARE
TWEET

Untitled

a guest Jul 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Convert Doc to PDF
  2. function example61() {
  3.   //Make copy of Doc
  4.   const masterDoc = DriveApp.getFileById('ADD FILE ID HERE');
  5.   const newDoc = masterDoc.makeCopy("EXAMPLE 61 - Company document");
  6.   const newDocId = newDoc.getId();
  7.  
  8.   //create a PDF file from this Doc
  9.   const pdf = DriveApp.getFileById(newDocId).getAs('application/pdf');
  10.   pdf.setName(newDoc.getName() + ".pdf");
  11.   const docPdf = DriveApp.createFile(pdf);
  12.  
  13.   //Add a copy of pdf in doc folder, delete original pdf, & delete orig Doc  
  14.   const folder = DriveApp.getFolderById('ADD FOLDER ID HERE');
  15.   folder.addFile(docPdf);
  16.   DriveApp.removeFile(docPdf);
  17.   DriveApp.getFileById(newDocId).setTrashed(true);  
  18. }
  19.  
  20. //Create image of a map
  21. function example62() {
  22.   const map = Maps.newStaticMap().setCenter('Chepstow castle, Chepstow, UK');
  23.   DriveApp.createFile(map);
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top