On Edit (Google Script) - google-apps-script

function onEdit(e)
{
var datum = Utilities.formatDate(new Date(), "GMT+1", "dd.MM.YYYY");
var ss = SpreadsheetApp.getActive();
var newas = SpreadsheetApp.create("Sperren");
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sperren');
sheet.activate();
var temp = ss.duplicateActiveSheet();
range = temp.getDataRange();
range.copyTo(range, {contentsOnly: true});
temp.copyTo(newas);
ss.deleteSheet(temp);
newas.getSheetByName('Sperren');
newas.deleteActiveSheet();
var folderID = "Sperr Material";
var folderID2 = "Prozess";
var datei = newas.getRange("C3").getValues();
// var dateid = newas.getRange("G6").getValues();
var folder = DriveApp.getFoldersByName(folderID);
var theblob = newas.getBlob().setName(datei +" "+ datum);
var newFile = folder.next().createFolder(folderID2 +" "+ datei + " "+ datum).createFile(theblob);
}
/* #Process Form */
function processForm(formObject)
{
var url = "https://https://docs.google.com/spreadsheets/d/1v03Se_BaW-SqFJpN8TU9oEhT2eSvMRHvqwnh3s14lPY/edit#gid=645028893";
var as = SpreadsheetApp.openByUrl(url);
var ws = as.getSheetByName("Test");
/*ws.appendRow([formObject.material,
formObject.stückzahl,
formObject.label,
formObject.datum,
formObject.grund,
formObject.lgort,
formObject.name,
formObject.sgrund]);*/
ws.getRange("A2").setValue(formObject.material);
ws.getRange("B2").setValue(formObject.stückzahl);
ws.getRange("C2").setValue(formObject.label);
ws.getRange("D2").setValue(formObject.datum);
ws.getRange("E2").setValue(formObject.grund);
ws.getRange("F2").setValue(formObject.lgort);
ws.getRange("G2").setValue(formObject.name);
ws.getRange("H2").setValue(formObject.sgrund);
}
Can anyone help me here, i have Html Formular which sends the values to Google Sheet and Sheet should save on one column.
After that it should be transfer the value to another sheet, where is a specific Table, after that it should be save this table to Drive App with informations.
The first column will be changed by either request and by new change should Google Sheet save a new Datei.
but my OnEdit code will not work
if there is a new change should Google save it to a Folder in Drive APP.
But this onEdit code will not work :)

Related

Create new document from Google form and add to a new folder

I have a Google script triggered on submission of a form. It creates a new doc based on a template with certain variables in-filled from answers in the form.
I also have a folder created on the form submission.
The trouble I am having is creating the newly created doc within the newly created folder. Looking for some help merging the two scripts that work on their own to acheive this.
Creating a folder on form submission:
function createChannelFolder() {
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("Completed Certifications");
var ChannelName = names.getRange(names.getLastRow(), 2).getValue();
var parentFolder=DriveApp.getFolderById("FOLDERID");
return newFolder=parentFolder.createFolder(ChannelName);
}
Creating a document on form submission
function autoFillGoogleDocFromForm(e) {
//e.values is an array of form values
var Timestamp = e.values[0];
var Channel = e.values[1];
var Name = e.values[2];;
var file = DriveApp.getFileById('FILEID');
var folder = DriveApp.getFolderById('FOLDERID')
var copy = file.makeCopy(Channel + ',' + Name, folder);
var newId = copy.getId();
var doc = DocumentApp.openById(newId);
var body = doc.getBody();
body.replaceText('{{Timestamp}}', Timestamp);
body.replaceText('{{Channel}}', Channel);
body.replaceText('{{Name}}', Name);
doc.saveAndClose();
}
Explanation:
You need to call createChannelFolder() inside
autoFillGoogleDocFromForm(e).
just return the folder object within createChannelFolder():
return parentFolder.createFolder(ChannelName);
Solution:
Here is autoFillGoogleDocFromForm(e):
function autoFillGoogleDocFromForm(e) {
//e.values is an array of form values
var Timestamp = e.values[0];
var Channel = e.values[1];
var Name = e.values[2];;
var file = DriveApp.getFileById('FILEID');
var folder = createChannelFolder(); // 1st modification point
var copy = file.makeCopy(Channel + ',' + Name, folder);
var newId = copy.getId();
var doc = DocumentApp.openById(newId);
var body = doc.getBody();
body.replaceText('{{Timestamp}}', Timestamp);
body.replaceText('{{Channel}}', Channel);
body.replaceText('{{Name}}', Name);
doc.saveAndClose();
}
and here is createChannelFolder():
function createChannelFolder() {
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("Completed Certifications");
var ChannelName = names.getRange(names.getLastRow(), 2).getValue();
var parentFolder=DriveApp.getFolderById("FOLDERID");
return parentFolder.createFolder(ChannelName); // 2nd modification point
}

Google Sheets Email - Vlookup showing REF value in PDF

Hoping you could help me with this, I have created a system that automatically sends the current sheet as an attachment in an email with body and subject text.
I have one problem that I cant seem to solve; the Vlookup used in the sheet generates either a blank column or a REF! on the emailed PDF. And any info directing to another value from a different sheet (eg ='Sheet2'!D2)
Here is the code used on the sheet triggering the PDF attachment :
function mailCCB() {
var originalSpreadsheet = SpreadsheetApp.getActive(); //get active spreadsheet
var message = "Good Day." + "\n\n" + "Please find attached certificate"; //email body
var certNo = originalSpreadsheet.getRange("C7").getValue(); //certificate number
var cust = originalSpreadsheet.getRange("E10").getValues(); //customer name
var subject = "Certificate " + certNo + " | " + cust; //email subject
var emailTo = originalSpreadsheet.getRange("E13").getValue(); //email address
var sheets = originalSpreadsheet.getSheets(); //get all sheets
var sheetName = originalSpreadsheet.getActiveSheet().getName(); //get current sheet name
var sourceSheet = originalSpreadsheet.getSheetByName(sheetName); //source sheet
// Get folder containing spreadsheet to save pdf in.
var parents = DriveApp.getFileById(originalSpreadsheet.getId()).getParents();
if (parents.hasNext()) {
var folder = parents.next();
}
else {
folder = DriveApp.getRootFolder();
}
SpreadsheetApp.getActiveSpreadsheet().toast("Working on it.. 50%", "Busy",12);
// Copy whole spreadsheet.
var destSpreadsheet = SpreadsheetApp.open(DriveApp.getFileById(originalSpreadsheet.getId()).makeCopy("tmp_convert_to_pdf", folder))
// Delete redundant sheets.
var sheets = destSpreadsheet.getSheets();
for (i = 0; i < sheets.length; i++) {
if (sheets[i].getSheetName() != sheetName){
destSpreadsheet.deleteSheet(sheets[i]);
}
}
var destSheet = destSpreadsheet.getSheets()[0];
var sourceRange = sourceSheet.getRange(1,1,sourceSheet.getMaxRows(),sourceSheet.getMaxColumns());
var sourcevalues = sourceRange.getValues();
SpreadsheetApp.getActiveSpreadsheet().toast("Working on it.. 60%", "Busy",12);
var destRange = destSheet.getRange(1, 1, destSheet.getMaxRows(), destSheet.getMaxColumns());
destRange.setValues(sourcevalues);
var theBlob = destSpreadsheet.getBlob().getAs('application/pdf').setName(subject);
var newFile = folder.createFile(theBlob);
//*****************************
SpreadsheetApp.getActiveSpreadsheet().toast("Working on it.. 75%", "Busy",12);
// Create a new Spreadsheet and copy the current sheet into it.
var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export");
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var projectname = SpreadsheetApp.getActiveSpreadsheet();
sheet = originalSpreadsheet.getActiveSheet();
sheet.copyTo(newSpreadsheet);
var pdf = DriveApp.getFileById(originalSpreadsheet.getId()).getAs('application/pdf').getBytes();
var attach = {fileName:'Klerkscale Certificate',content:pdf, mimeType:'application/pdf'};
MailApp.sendEmail(emailTo, subject, message, {attachments:[theBlob]});
DriveApp.getFileById(newSpreadsheet.getId()).setTrashed(true);
originalSpreadsheet.toast("Certificate will be sent shortly to " + emailTo,"Success",20);
}
This is the cropped received email result :
Ok I saw your problem, you're deleting all the sheets which are being referenced by the active sheet in destSpreadsheet thus they will not be available and the results will be #REF! for each cell referencing those deleted sheets. To solve that problem you could use the getDisplayValues() method, which retrieves the current displayed value of the cell instead of getValues() which retrieves the function(VLOOKUP in this case) set in the cell. Change this line:
var sourcevalues = sourceRange.getValues();
For this:
var sourcevalues = sourceRange.getDisplayValues();
Also, don't delete the other sheets which are being referenced until you have copyied the values to destRange in this line:
destRange.setValues(sourcevalues);

How to loop data and print each iteration to PDF in a defined Google Drive folder

I'm a novice at GAS, so please bear with me.
I'd like to create a script for a Google Sheet that will loop through a series of values, pause at each value, and print a specific tab from the sheet to a defined location in Google Drive (creating a new folder with a date within the parent folder). Below is what I have so far, which achieves looping and printing, but I can't figure out how to get it to save the PDF files to a specific folder. Grateful for any help! Thank you.
Link to dummy spreadsheet with script here, and target Google Drive folder here.
function loop() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var validation_sheet = ss.getSheetByName('Validation');
var lastRow = validation_sheet.getLastRow();
var inputs = ss.getSheetByName('Validation').getRange('A2:A'+lastRow).getValues();
var sheet2 = ss.getSheetByName('Loadout');
var tab = ss.getSheetByName('Loadout');
var formattedDate = Utilities.formatDate(new Date(), "GMT+5", "yyyy-MM-dd hh:mm");
//Create Folder for PDFs
var fld = DriveApp.createFolder(formattedDate);
fld.addFile(DriveApp.getFileById(ss.getId()));
for (var i = 0; i < inputs.length; i++) {
sheet2.getRange('A1').setValue(inputs[i][0]);
SpreadsheetApp.flush();
Utilities.sleep(5000);
//Print PDFs
var name = tab.getRange(1, 1).getValue();
fld.createFile(ss.getAs('application/pdf')).setName(name);
}
DriveApp.getRootFolder().removeFile(DriveApp.getFileById(ss.getId()));
}
You want to create PDF files to "target Google Drive folder". https://drive.google.com/drive/u/1/folders/1QmjXLyssyCGU16ApLQ4Anj_kir0uuQS8
If my understanding is correct, how about this modification?
Modification points:
Retrieve the target folder using DriveApp.getFolderById().
When PDF file is created, it creates the file to the target folder.
Modified script:
function loop() {
var targetFolderId = "1QmjXLyssyCGU16ApLQ4Anj_kir0uuQS8"; // Added
var targetFolder = DriveApp.getFolderById(targetFolderId); // Added
var ss = SpreadsheetApp.getActiveSpreadsheet();
var validation_sheet = ss.getSheetByName('Validation');
var lastRow = validation_sheet.getLastRow();
var inputs = ss.getSheetByName('Validation').getRange('A2:A'+lastRow).getValues();
var sheet2 = ss.getSheetByName('Loadout');
var tab = ss.getSheetByName('Loadout');
// var formattedDate = Utilities.formatDate(new Date(), "GMT+5", "yyyy-MM-dd hh:mm"); // Removed
//Create Folder for PDFs
// var fld = DriveApp.createFolder(formattedDate); // Removed
// fld.addFile(DriveApp.getFileById(ss.getId())); // Removed
for (var i = 0; i < inputs.length; i++) {
sheet2.getRange('A1').setValue(inputs[i][0]);
SpreadsheetApp.flush();
Utilities.sleep(5000);
//Print PDFs
var name = tab.getRange(1, 1).getValue();
targetFolder.createFile(ss.getAs('application/pdf')).setName(name); // Modified
}
// DriveApp.getRootFolder().removeFile(DriveApp.getFileById(ss.getId())); // Removed
}
Note:
In your script, the active spreadsheet is also moved to a created new folder. About this, how do you want to do?
References:
getFolderById(id)
If I misunderstand your question, please tell me. I would like to modify it.
Edit:
When you run the script, at first, you want to create new folder in the target folder. Then, you want to create PDF files in the created folder.
About the active spreadsheet, do nothing.
I understood like above. If my understanding is correct, how about this modification?
Modified script:
function loop() {
var targetFolderId = "1QmjXLyssyCGU16ApLQ4Anj_kir0uuQS8"; // Added
var targetFolder = DriveApp.getFolderById(targetFolderId); // Added
var ss = SpreadsheetApp.getActiveSpreadsheet();
var validation_sheet = ss.getSheetByName('Validation');
var lastRow = validation_sheet.getLastRow();
var inputs = ss.getSheetByName('Validation').getRange('A2:A'+lastRow).getValues();
var sheet2 = ss.getSheetByName('Loadout');
var tab = ss.getSheetByName('Loadout');
var formattedDate = Utilities.formatDate(new Date(), "GMT+5", "yyyy-MM-dd hh:mm");
//Create Folder for PDFs
var fld = targetFolder.createFolder(formattedDate); // Modified
// fld.addFile(DriveApp.getFileById(ss.getId())); // Removed
for (var i = 0; i < inputs.length; i++) {
sheet2.getRange('A1').setValue(inputs[i][0]);
SpreadsheetApp.flush();
Utilities.sleep(5000);
//Print PDFs
var name = tab.getRange(1, 1).getValue();
fld.createFile(ss.getAs('application/pdf')).setName(name); // Modified
}
// DriveApp.getRootFolder().removeFile(DriveApp.getFileById(ss.getId())); // Removed
}

Copy Value and Format to new sheet in Google sheets using a script

In Google Apps Script, Im using the script below to create a pdf and send as an email.
The problem is that when it creates the new sheet and copies across, the formulas are copied. The emailed PDF than shows a REF error.
I need to copy the Value and Format.
Thanks
function exportPDF() {
var originalSpreadsheet = SpreadsheetApp.getActive();
var message = "Please see attached";
var projectname = originalSpreadsheet.getRange("a2:c2").getValues();
var period = originalSpreadsheet.getRange("B24:c24").getValues();
var subject = projectname + " - Daily Control Totals - " + period;
var contacts = originalSpreadsheet.getSheetByName("Contacts");
var numRows = contacts.getLastRow();
var emailTo = contacts.getRange(2, 2, numRows, 1).getValues();
var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export");
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var projectname = SpreadsheetApp.getActiveSpreadsheet();
sheet = originalSpreadsheet.getActiveSheet();
sheet.copyTo(newSpreadsheet);
newSpreadsheet.getSheetByName('Sheet1').activate();
newSpreadsheet.deleteActiveSheet();
DriveApp.getFileById(newSpreadsheet.getId()).getAs('application/pdf').getBytes();
var attach = {fileName:'Daily Totals.pdf',content:pdf, mimeType:'application/pdf'};
MailApp.sendEmail(emailTo, subject, message, {attachments:[attach]});
DriveApp.getFileById(newSpreadsheet.getId()).setTrashed(true);}
Currently, if you have references to other sheets in the sheet you are copying, after copying you will get REF errors, which makes sense as the data is no longer where it should be.
To avoid that when we can use Range's copyTo(Range, Object); method. However, this method can only be used within a single spreadsheet, so we need to create a temporary sheet that will store our values then copy the sheet to a new spreadsheet to send in an email:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = SpreadsheetApp.getActiveSheet();
var newSS = SpreadsheetApp.create("Spreadsheet to export");
var temp = ss.duplicateActiveSheet(); //create temp sheet that lets us copy the values
range = temp.getDataRange();
range.copyTo(range, {contentsOnly: true}); //copy the values
temp.copyTo(newSS); //copy the values to a new spreadsheet
ss.deleteSheet(temp); //delete our temp sheet.
Updated: So your code would look something like this:
function exportPDF() {
var originalSpreadsheet = SpreadsheetApp.getActive();
var message = "Please see attached";
var projectname = originalSpreadsheet.getRange("a2:c2").getValues();
var period = originalSpreadsheet.getRange("B24:c24").getValues();
var subject = projectname + " - Daily Control Totals - " + period;
var contacts = originalSpreadsheet.getSheetByName("Contacts");
var numRows = contacts.getLastRow();
var emailTo = contacts.getRange(2, 2, numRows, 1).getValues();
var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export");
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet = originalSpreadsheet.getActiveSheet();
var temp = originalSpreadsheet.duplicateActiveSheet(); //create temp sheet that lets us copy the values
range = temp.getDataRange();
range.copyTo(range, {contentsOnly: true}); //copy the values
temp.copyTo(newSpreadsheet); //copy the values to a new spreadsheet
ss.deleteSheet(temp); //delete our temp sheet.
newSpreadsheet.getSheetByName('Sheet1').activate();
newSpreadsheet.deleteActiveSheet();
DriveApp.getFileById(newSpreadsheet.getId()).getAs('application/pdf').getBytes();
var attach = {fileName:'Daily Totals.pdf',content:pdf, mimeType:'application/pdf'};
MailApp.sendEmail(emailTo, subject, message, {attachments:[attach]});
DriveApp.getFileById(newSpreadsheet.getId()).setTrashed(true);
}

New Spreadsheet; .clearContent(); Getting error that user is trying to edit protected cell

In the new Google Spreadsheet I have a large script that clears the contents from many cells throughout 8 different sheets.
The formulas that total up the sheet is the only section that is protected, but I keep getting the error on the .clearContent(); method when the script isn't touching any of the protected cells.
Any thoughts? This is the identical script used (working perfect) on the old spreadsheets.
function masterCloseWeek() {
var hideLiqOrder = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('LIQUOR ORDER');
hideLiqOrder.hideSheet();
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var costReport = spreadsheet.getSheetByName('COST REPORT').activate();//Moves sheet to position 1
spreadsheet.moveActiveSheet(1);
var invoiceLog = spreadsheet.getSheetByName('INVOICE LOG').activate();//Moves sheet to position 2
spreadsheet.moveActiveSheet(2);
var dailyInventory = spreadsheet.getSheetByName('DAILY INVENTORY').activate();//Moves sheet to position 3
spreadsheet.moveActiveSheet(3);
SpreadsheetApp.flush();
var spreadsheetId = 'xxxxxxxxxxxx'; //ID
var file = Drive.Files.get(spreadsheetId);
var url = file.exportLinks['application/pdf'];
var token = ScriptApp.getOAuthToken();
var response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + token
}
});
//var pdf = response.getBlob();
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getName();
var pdf = response.getBlob().setName(ss.getName() + '.pdf');
var CopyDate = Utilities.formatDate(new Date(), "GMT-3", "MM/dd/yyyy HH:mm"); // Funtion Date + Format
DocsList.createFile(pdf);
MailApp.sendEmail({
to:"myEmail#test.com",
subject: "Blank (v2.0) Weekly File Attached" + "_" + "Sent on " + CopyDate,
body:"(This is an automated email.).....Attached is a copy of the weekly file sent on" + " "+CopyDate,
attachments: [pdf]
})
var hideLiqOrder = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('LIQUOR ORDER');
hideLiqOrder.showSheet();
var liquorInventory = SpreadsheetApp.getActive().getSheetByName('LIQUOR INVENTORY');
liquorInventory.getRange('J6:J588').copyTo(liquorInventory.getRange('M6:M588'),{contentsOnly:true});
var foodInventory = SpreadsheetApp.getActive().getSheetByName('FOOD INVENTORY');
foodInventory.getRange('G5:G622').copyTo(foodInventory.getRange('I5:I622'),{contentsOnly:true});
//Finished closing week
//Starting a new week
var activeSheet = SpreadsheetApp.getActiveSpreadsheet();
var costReport = activeSheet.getSheetByName('COST REPORT');
var FraminghamSnapShot = activeSheet.getSheetByName('FraminghamSnapShot');
costReport.getRange('E12:E16').copyTo(FraminghamSnapShot.getRange('B23:B27'),{contentsOnly:true});
This is the first error, when it tries to clear invoiceLog.getRange('A3:L52').clearContent();
var invoiceLog = SpreadsheetApp.getActive().getSheetByName('INVOICE LOG');
invoiceLog.getRange('A3:L52').clearContent();
var dailyInventory = SpreadsheetApp.getActive().getSheetByName('DAILY INVENTORY');
dailyInventory.getRange('C5:C9').clearContent();
dailyInventory.getRange('D6:I9').clearContent();
dailyInventory.getRange('C13:C17').clearContent();
dailyInventory.getRange('D14:I17').clearContent();
dailyInventory.getRange('C21:C25').clearContent();
dailyInventory.getRange('D22:I25').clearContent();
dailyInventory.getRange('C29:C33').clearContent();
dailyInventory.getRange('D30:I33').clearContent();
dailyInventory.getRange('C37:C41').clearContent();
dailyInventory.getRange('D38:I41').clearContent();
dailyInventory.getRange('C45:C49').clearContent();
dailyInventory.getRange('D46:I49').clearContent();
dailyInventory.getRange('C55:C59').clearContent();
dailyInventory.getRange('D56:I59').clearContent();
dailyInventory.getRange('C63:C67').clearContent();
dailyInventory.getRange('D64:I67').clearContent();
dailyInventory.getRange('C71:C75').clearContent();
dailyInventory.getRange('D72:I75').clearContent();
dailyInventory.getRange('C79:C83').clearContent();
dailyInventory.getRange('D80:I83').clearContent();
dailyInventory.getRange('C87:C91').clearContent();
dailyInventory.getRange('D88:I91').clearContent();
dailyInventory.getRange('C95:C99').clearContent();
dailyInventory.getRange('D96:I99').clearContent();
dailyInventory.getRange('C105:C109').clearContent();
dailyInventory.getRange('D106:I109').clearContent();
dailyInventory.getRange('C113:C117').clearContent();
dailyInventory.getRange('D114:I117').clearContent();
dailyInventory.getRange('C121:C125').clearContent();
dailyInventory.getRange('D122:I125').clearContent();
dailyInventory.getRange('C129:C133').clearContent();
dailyInventory.getRange('D130:I133').clearContent();
dailyInventory.getRange('C137:C141').clearContent();
dailyInventory.getRange('D138:I141').clearContent();
dailyInventory.getRange('C145:C149').clearContent();
dailyInventory.getRange('D146:I149').clearContent();
var foodInventory = SpreadsheetApp.getActive().getSheetByName('FOOD INVENTORY');
foodInventory.getRange('D5:F622').clearContent();
var liquorInventory = SpreadsheetApp.getActive().getSheetByName('LIQUOR INVENTORY');
liquorInventory.getRange('E6:I371').clearContent(); //Vodka thru Wines
liquorInventory.getRange('G375:I433').clearContent(); //Draft Beer
liquorInventory.getRange('G437:I535').clearContent(); //Bottle Beer
liquorInventory.getRange('E539:I588').clearContent(); //Non Alcoholic
var dailySalesSheet = SpreadsheetApp.getActive().getSheetByName('DAILY SALES SHEET');
dailySalesSheet.getRange('B4:H11').clearContent(); //Sales Categories
var costReport = SpreadsheetApp.getActive().getSheetByName('COST REPORT');
costReport.getRange('F12:F16').clearContent(); //Theoreticals
costReport.getRange('D20:D20').clearContent(); //Week Ending Date
var safeAudit = SpreadsheetApp.getActive().getSheetByName('SAFE AUDIT');
safeAudit.getRange('C3:P11').clearContent();
safeAudit.getRange('C14:P18').clearContent();
safeAudit.getRange('C22:P22').clearContent();
var destination = SpreadsheetApp.getActiveSpreadsheet();
Browser.msgBox('Closed Successfully','Your week has been successfully closed\\n and emailed.', Browser.Buttons.OK);
var name = Browser.inputBox('Enter Week Ending Date ONLY', 'Example: 11-5-14 \\n\\n', Browser.Buttons.OK);
destination.rename("BlankWE" + name);
costReport.getRange('D20').setValue(name);
}
Is there a better more efficient way to clear cells? Would that help solve the issue?
Sean.
Well, I don't find anything wrong in your invoiceLog.getRange('A3:L52').clearContent();, it works perfectly for me.