I'm creating a small database inside a sheet, I need the script to copy data to another sheet tab and I'm getting an empty error. I'm not expert on javascript so what code I'm missing here?
Basically, when you press a button you get a text modal with an input so the person writes the name and then the script gets all the Rows with a TRUE (checkbox) and copies everything to another sheet with a header saying the data and time with the name of the person. If returns nulled with everything FALSE wont copy and shows a text modal saying that there's no task done today.
Thanks in advance
function moveValuesOnly() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var source = ss.getRange ("RESUMO!A4:J99");
var destSheet = ss.getSheetByName("LOG Resumo");
var row = destSheet.getLastRow()+2; //the starting column of the range
var column = 1; //the starting row of the range
var numRows = 97; //the number of rows to return
var numColumns = 10; //the number of columns to return
var destRange = destSheet.getRange(row, column, numRows, numColumns);
var input_text = Browser.inputBox("Encarregado de Turno","Escreve seu nome:", Browser.Buttons.OK);
var now = new Date();
var active = ss.getSheetByName("RESUMO");
var condition = active.getRange('RESUMO!J4:J99').getValue();
var valueToWatch = "TRUE";
if (condition == valueToWatch) {
destSheet.getRange(row-1,1,1,10).mergeAcross().setBackgroundRGB(224, 102, 102).setFontColor("white");
destSheet.getRange(row-1,1,1).setValue(now + " ~~ ENCARREGADO DE FECHAR TURNO: " + input_text).activate();
source.copyTo(destRange, {contentsOnly: true}).setFontColor("black");
} else {
Browser.msgBox("Erro","Não exite tarefas completas hoje", Browser.Buttons.OK);
}
}
var condition = active.getRange('RESUMO!J4:J99').getValue();is equivalent to thisvar condition = active.getRange('RESUMO!J4').getValue();- Cooper