I'm trying to extend this working script to include a check for matching columns prior to copying.
function copyInfo() // https://stackoverflow.com/questions/44967086/copy-data-from-one-sheet-to-another-in-google-app-script-and-append-a-row-one-s
{
var copySheet = ssA.getSheetByName("export");
var pasteSheet = ssA.getSheetByName("paste");
var compareFrom = copySheet.getRange('B2:B99');
var compareTo = pasteSheet.getRange('C2:C99');
// if(compareFrom == compareTo){
var source = copySheet.getRange('N1:O99'); // get source range
var destination = ss.getRange('O1:P99'); // get destination range
source.copyTo(destination); // copy values to destination range
source.clearContent(); // clear source values
// } else{SpreadsheetApp.getUi().alert("rows don't match!");}
}
Basically, I want to check that the values in column B on the source sheet are in the same order of the values of column C of the paste sheet.