I am a novice to google app scripts. However I need to copy selected rows (with a checkbox) to a second sheet. I am using this code below. However it copies the entire source sheet. I only need rows that I select to be copied.Can someone please show me how to add a "checkbox" within the script so only the rows I checked are copied. Thanks
Code:
function copyRows() { var ss=SpreadsheetApp.getActive(); var ssh=ss.getSheetByName("data 1"); var tsh=ss.getSheetByName("Sheet1"); var srg=ssh.getRange(2,1,ssh.getLastRow()+1,ssh.getLastColumn());//assume 1 header row var svs=srg.getValues(); var trg=tsh.getRange(2,1,tsh.getLastRow()+1,1);//assume 1 header row var tvs=trg.getValues().map(function(r){return new Date(r[0]).valueOf();}); svs.forEach(function(r,i){//if it is not in the target then append it to the target if(tvs.indexOf(new Date(r[0]).valueOf())==-1) { tsh.appendRow(r); } });}Note: my header does not contain a date column as mentioned below. However I will ask questions on that later.