I've done some reading but my limited knowledge on scripts is making things difficult. I want to:
- Copy a data range (C3:F20) from one sheet
- Paste that data in a new sheet
- In the new sheet, add today's date formatted (DD/MM/YYYY) in a new column
I've managed to get 1 and 2 working, but can't work out the 3rd. See current script below.
function Copy() {
var sss = SpreadsheetApp.openById('ID#');
var ss = sss.getSheetByName('Workout');
var range = ss.getRange('C3:F20');
var data = range.getValues();
var tss = SpreadsheetApp.openById('ID#');
var ts = tss.getSheetByName('Log');
ts.getRange(ts.getLastRow()+1, 1, data.length, data[0].length).setValues(data);
}
What I have:
What I want:


var d = new Date()Date() is a function. It's not a method. After getting the date object, you can format the date withUtilities.formatDate()Link to Apps Script Doc - formatDate Please read the troubleshooting guide: Link to Apps Script troubleshooting - Alan Wells