これはあなたが望むことをするはずです...あなたが本当に欲しいものがわからないのでテストしなかったので、デバッグが必要かもしれません;-)
function copynotempty(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = SpreadsheetApp.setActiveSheet(ss.getSheets()[0])
var col = 1 ; // choose the column you want to check: 0 = col A, 1= col B ...
var range = sh.getDataRange();
var values=range.getValues();// data is a 2D array, index0 = col A
var formulas=range.getFormulas();// data is a 2D array, index0 = col A
var target=new Array();// this is a new array to collect data
for(n=0;n<range.getHeight();++n){
if (values[n][col]!=''|| formulas[n][col]!=''){ ;
for (cc=0;cc<range.getWidth();++cc){
if (formulas[n][cc]!=''){target[n][cc]=formulas[n][cc]}else{target[n][cc]=values[n][cc]}
// if the cell has a formula copy it or else copy the value, do that for the whole row
// (this also defines and apply the 'priority' you mentioned in your question, I wasn't sure if it should apply to the whole row or only on column B)
}
}
}
if(target.length>0){// if there is something to copy
var sh2=SpreadsheetApp.setActiveSheet(ss.getSheets()[1]); //second sheet of your spreadsheet
sh2.getRange(1,1,target.length,target[0].length).setValues();// paste the selected values in the 2cond sheet
}
}