I have a code that copy pastes data from one sheet to another workbook whenever I run it. However, I only want specific data to copy from the original sheet where column K is not null. Could someone help recommend how I can incorporate that in my code?
Thanks in advance!
function transferList()
{
var sourceSheet =
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Colombo");
var sourceData = sourceSheet.getDataRange().getValues();
sourceData.splice(0,1); // Remove header
var targetSS = .
SpreadsheetApp.openById("TargetSheetID").getSheetByName("Tester");
var targetRangeTop = targetSS.getLastRow(); // Get # rows currently in target
targetSS.getRange(targetRangeTop+1,1,sourceData.length,sourceData[0].length).setValues(sourceData);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…