I'm writing a little script to automatically copy/past some data from one sheet to another sheet.
I've come up with the following script :
function test() {
var sheet = SpreadsheetApp.openById('1sLVRDzzOopFQrXLNtAYKfyBfJthCkjvK8xe_PtOmso0').getSheetByName('Sheet1');
var numRows = sheet.getLastRow()-1;
for(var i = 0; i < numRows; i++) {
// Dispatching Data
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2")
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1")
var data1 = sheet.getRange('Sheet1!A2:G2').getValues();
sheet.appendRow([data1]);
ss.deleteRow(2)
}
}
It's working perfectly fine but return me the following response :
Ljava.lang.Object response...
for each row.
What should I do ? thanks !
If you want to use your script then the simple fix is to change:
to:
because you only want the 1 row.
However I'm not sure what the point of your for loop is? This might be a little cleaner: