What i want to achieve:
- When the last column indicates TRUE i will send an email to the respective recipient (created a button and assigned it to a script)
- Only Move/Copy data from Sheet1 to Sheet2 when last column indicates TRUE
- Data moved to Sheet2 will be written in new row(append new row)
- Data in Sheet1 will be deleted,but it should not affect data in Sheet2.
What is the issue:
- Data do not move from sheet1 to Sheet2
Below are my codes:
function moveData(){
var app = SpreadsheetApp;
var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
var originalSheet = app.getActiveSpreadsheet().getSheetByName("Form
Responses 4");
var copySheet = app.getActiveSpreadsheet().getSheetByName("Sheet2");
var lc = originalSheet.getLastColumn();
var lr = originalSheet.getLastRow();
var secondRangeTop = copySheet.getLastRow();
for (var i=2; i<=lr+1 ; i++){
var tempNumber = originalSheet.getRange(i,1,lr,lc).getValues();
var daTa = copySheet.getRange(secondRangeTop+1, 1, tempNumber.length, lc).setValues(tempNumber);
Logger.log(daTa);
}
return daTa;
}