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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Posting a File and Associated Data to a RESTful WebService preferably as JSON2019 Community Moderator ElectionREST URI convention - Singular or plural name of resource while creating itUploading both data and files in one form using Ajax?How do I upload a file with metadata using a REST web service?REST API - file (ie images) processing - best practicesSpring: JSON data and file in the same requestREST API Put large dataPosting a file and JSON data to Spring rest serviceRESTful Web Service Upload/Download Large Data With JSONREST API Design sending JSON data and a file to the api in same requestPost JSONArray to REST servicePUT vs. POST in RESTParsing values from a JSON file?JavaScript/jQuery to download file via POST with JSON dataHow do I upload a file with metadata using a REST web service?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?Separate REST JSON API server and client?what's the correct way to send a file from REST web service to client?How do I write JSON data to a file?What is “406-Not Acceptable Response” in HTTP?REST API - file (ie images) processing - best practices

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page