DriveApp in google apps script is not working [closed]Daily Script Error Reports - ReferenceError: “errorHandling_” is not defined. (line X, file “Code”)How to update DocsList to DriveApp in my codeUpdating Google Doc script to Google Drive (Archive emails with tags to drive)Google Apps Script Utilities.parseCsv() and replacement character - �Write a triggerable weekly backup of a fileusing Google Apps Script: how to convert/export a Drive file?TypeError: Cannot call method “getRange” of null. (line 9, file “Code”)Using a cell value in Google Sheets as an input to move a file from one folder to another using Google App ScriptGoogle Script gives unknown errorApps Script - Create pdf from modified sheet returns double original sheet

Open a doc from terminal, but not by its name

What is going on with 'gets(stdin)' on the site coderbyte?

What should you do when eye contact makes your subordinate uncomfortable?

Is there an injective, monotonically increasing, strictly concave function from the reals, to the reals?

Mimic lecturing on blackboard, facing audience

How should I respond when I lied about my education and the company finds out through background check?

How does the math work for Perception checks?

When were female captains banned from Starfleet?

Why does the Sun have different day lengths, but not the gas giants?

Does Doodling or Improvising on the Piano Have Any Benefits?

15% tax on $7.5k earnings. Is that right?

Calculating total slots

Picking the different solutions to the time independent Schrodinger eqaution

Is there a way to get `mathscr' with lower case letters in pdfLaTeX?

Yosemite Fire Rings - What to Expect?

Redundant comparison & "if" before assignment

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Why is the "ls" command showing permissions of files in a FAT32 partition?

Extract more than nine arguments that occur periodically in a sentence to use in macros in order to typset

Quoting Keynes in a lecture

Calculate sum of polynomial roots

Mixing PEX brands

What is Cash Advance APR?

What are the advantages of simplicial model categories over non-simplicial ones?



DriveApp in google apps script is not working [closed]


Daily Script Error Reports - ReferenceError: “errorHandling_” is not defined. (line X, file “Code”)How to update DocsList to DriveApp in my codeUpdating Google Doc script to Google Drive (Archive emails with tags to drive)Google Apps Script Utilities.parseCsv() and replacement character - �Write a triggerable weekly backup of a fileusing Google Apps Script: how to convert/export a Drive file?TypeError: Cannot call method “getRange” of null. (line 9, file “Code”)Using a cell value in Google Sheets as an input to move a file from one folder to another using Google App ScriptGoogle Script gives unknown errorApps Script - Create pdf from modified sheet returns double original sheet













-1















I have a simple script to create a pdf of a google sheet and save it in a drive folder however when I run the script I get this error:
TypeError: Cannot find function getFolderByID in object Drive.



I noticed that DriveApp is black and not blue. I am wondering if this is the problem and how to fix it.



function MakePDF() 
var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF');
var FolderID = Testsheet1.getRange('B40').getValue();
var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID);
var ss = SpreadsheetApp.getActive();
var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder));
var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
var newFile = folder.createFile(theBlob);
DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);










share|improve this question















closed as off-topic by Cody Gray Mar 8 at 3:26


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Cody Gray
If this question can be reworded to fit the rules in the help center, please edit the question.




















    -1















    I have a simple script to create a pdf of a google sheet and save it in a drive folder however when I run the script I get this error:
    TypeError: Cannot find function getFolderByID in object Drive.



    I noticed that DriveApp is black and not blue. I am wondering if this is the problem and how to fix it.



    function MakePDF() 
    var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF');
    var FolderID = Testsheet1.getRange('B40').getValue();
    var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID);
    var ss = SpreadsheetApp.getActive();
    var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder));
    var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
    var newFile = folder.createFile(theBlob);
    DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);










    share|improve this question















    closed as off-topic by Cody Gray Mar 8 at 3:26


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Cody Gray
    If this question can be reworded to fit the rules in the help center, please edit the question.


















      -1












      -1








      -1








      I have a simple script to create a pdf of a google sheet and save it in a drive folder however when I run the script I get this error:
      TypeError: Cannot find function getFolderByID in object Drive.



      I noticed that DriveApp is black and not blue. I am wondering if this is the problem and how to fix it.



      function MakePDF() 
      var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF');
      var FolderID = Testsheet1.getRange('B40').getValue();
      var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID);
      var ss = SpreadsheetApp.getActive();
      var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder));
      var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
      var newFile = folder.createFile(theBlob);
      DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);










      share|improve this question
















      I have a simple script to create a pdf of a google sheet and save it in a drive folder however when I run the script I get this error:
      TypeError: Cannot find function getFolderByID in object Drive.



      I noticed that DriveApp is black and not blue. I am wondering if this is the problem and how to fix it.



      function MakePDF() 
      var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF');
      var FolderID = Testsheet1.getRange('B40').getValue();
      var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID);
      var ss = SpreadsheetApp.getActive();
      var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder));
      var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
      var newFile = folder.createFile(theBlob);
      DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);







      google-apps-script






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 11 at 17:45









      Cooper

      8,0392829




      8,0392829










      asked Mar 8 at 1:54









      Tom VanOrderTom VanOrder

      1




      1




      closed as off-topic by Cody Gray Mar 8 at 3:26


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Cody Gray
      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by Cody Gray Mar 8 at 3:26


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Cody Gray
      If this question can be reworded to fit the rules in the help center, please edit the question.






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Did you write Drive.getFolderById() instead of DriveApp.getFolderById() ?



          • DriveApp

          You were very close to making it work. I'll post your version in your question and here's my corrected version. You can do a file compare to see the differences.



          function MakePDF() 
          var Testsheet1=SpreadsheetApp.getActive().getSheetByName('Test PDF');
          var FolderID=Testsheet1.getRange('B40').getValue();
          var pdfName="TestConvert";
          var folder=DriveApp.getFolderById(FolderID);
          var ss=SpreadsheetApp.getActive();
          var destSpreadsheet=SpreadsheetApp.openById(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder).getId());
          var theBlob=destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
          var newFile=folder.createFile(theBlob);
          DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);



          By the way, if you would have posted your code in your question it would have probably never put on hold and would have been answered very quickly.






          share|improve this answer

























          • function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

            – Tom VanOrder
            Mar 11 at 17:03


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Did you write Drive.getFolderById() instead of DriveApp.getFolderById() ?



          • DriveApp

          You were very close to making it work. I'll post your version in your question and here's my corrected version. You can do a file compare to see the differences.



          function MakePDF() 
          var Testsheet1=SpreadsheetApp.getActive().getSheetByName('Test PDF');
          var FolderID=Testsheet1.getRange('B40').getValue();
          var pdfName="TestConvert";
          var folder=DriveApp.getFolderById(FolderID);
          var ss=SpreadsheetApp.getActive();
          var destSpreadsheet=SpreadsheetApp.openById(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder).getId());
          var theBlob=destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
          var newFile=folder.createFile(theBlob);
          DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);



          By the way, if you would have posted your code in your question it would have probably never put on hold and would have been answered very quickly.






          share|improve this answer

























          • function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

            – Tom VanOrder
            Mar 11 at 17:03
















          1














          Did you write Drive.getFolderById() instead of DriveApp.getFolderById() ?



          • DriveApp

          You were very close to making it work. I'll post your version in your question and here's my corrected version. You can do a file compare to see the differences.



          function MakePDF() 
          var Testsheet1=SpreadsheetApp.getActive().getSheetByName('Test PDF');
          var FolderID=Testsheet1.getRange('B40').getValue();
          var pdfName="TestConvert";
          var folder=DriveApp.getFolderById(FolderID);
          var ss=SpreadsheetApp.getActive();
          var destSpreadsheet=SpreadsheetApp.openById(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder).getId());
          var theBlob=destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
          var newFile=folder.createFile(theBlob);
          DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);



          By the way, if you would have posted your code in your question it would have probably never put on hold and would have been answered very quickly.






          share|improve this answer

























          • function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

            – Tom VanOrder
            Mar 11 at 17:03














          1












          1








          1







          Did you write Drive.getFolderById() instead of DriveApp.getFolderById() ?



          • DriveApp

          You were very close to making it work. I'll post your version in your question and here's my corrected version. You can do a file compare to see the differences.



          function MakePDF() 
          var Testsheet1=SpreadsheetApp.getActive().getSheetByName('Test PDF');
          var FolderID=Testsheet1.getRange('B40').getValue();
          var pdfName="TestConvert";
          var folder=DriveApp.getFolderById(FolderID);
          var ss=SpreadsheetApp.getActive();
          var destSpreadsheet=SpreadsheetApp.openById(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder).getId());
          var theBlob=destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
          var newFile=folder.createFile(theBlob);
          DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);



          By the way, if you would have posted your code in your question it would have probably never put on hold and would have been answered very quickly.






          share|improve this answer















          Did you write Drive.getFolderById() instead of DriveApp.getFolderById() ?



          • DriveApp

          You were very close to making it work. I'll post your version in your question and here's my corrected version. You can do a file compare to see the differences.



          function MakePDF() 
          var Testsheet1=SpreadsheetApp.getActive().getSheetByName('Test PDF');
          var FolderID=Testsheet1.getRange('B40').getValue();
          var pdfName="TestConvert";
          var folder=DriveApp.getFolderById(FolderID);
          var ss=SpreadsheetApp.getActive();
          var destSpreadsheet=SpreadsheetApp.openById(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder).getId());
          var theBlob=destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName);
          var newFile=folder.createFile(theBlob);
          DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);



          By the way, if you would have posted your code in your question it would have probably never put on hold and would have been answered very quickly.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 11 at 17:36

























          answered Mar 8 at 2:28









          CooperCooper

          8,0392829




          8,0392829












          • function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

            – Tom VanOrder
            Mar 11 at 17:03


















          • function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

            – Tom VanOrder
            Mar 11 at 17:03

















          function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

          – Tom VanOrder
          Mar 11 at 17:03






          function MakePDF() var Testsheet1 = SpreadsheetApp.getActive().getSheetByName('Test PDF'); var FolderID = Testsheet1.getRange('B40').getValue(); var pdfName = "TestConvert" var folder = DriveApp.getFolderByID(FolderID); var ss = SpreadsheetApp.getActive(); var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(ss.getId()).makeCopy("tmp_convert_to_pdf", folder)); var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(pdfName); var newFile = folder.createFile(theBlob); DriveApp.getFileById(destSpreadsheet.getId()).setTrashed(true);

          – Tom VanOrder
          Mar 11 at 17:03






          Popular posts from this blog

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived