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
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
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
add a comment |
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
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
add a comment |
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
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
google-apps-script
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
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
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |