OK so I seem to be stumped by setValue() and setValues() I understand what they are, but can't get it to work. No values appear to be set! (This is part of a bigger script project to generate Invoices and Schedules from Google Calendar.)
function Version3() {
// STEPXX - First create a copy of the template
// Choose the source
var RHTemplate = 'MY SHEET ID'
var RHCode = "HirerCode"
// Use the variable for the Billing Prefix as it should be unique to create the folder.
var RHFolder = DriveApp.createFolder("BillPrefix").getId()
var RHFolderID = DriveApp.getFolderById(RHFolder);
// Now copy the template file
var RHgetTemplate = DriveApp.getFileById(RHTemplate);
// var RHFileName = (SpreadsheetApp.openById(RHTemplate).rename(RHCode));
var RHFile = RHgetTemplate.makeCopy(RHCode, RHFolderID);
var RHss = SpreadsheetApp.open(RHFile);
var RHsheetInv = RHss.getSheetByName('Invoice') //.getSheets()[0]; get by sheet index
var RHCell = RHsheetInv.getRange(1, 1);
RHCell.setValues([RHCode]);
debugger
}
I just can't see why it's not writing the words "Hirer Code" in the first cell on the sheet called "Invoice" in the spreadsheet called "Hirer Code" in the folder called "BillPrefix".
Any and all help appreciated!