I've just started learning javascript and I'm trying to do something like this:
I've got 2 different sheets, Sheet1 has some data while Sheet2 is empty. Sheet1 has numbers in column A and some stuff on other columns.
I was trying to make a script that runs when I imput an integer number on column A of Sheet2 (that had to be unique in that sheet and present on column A of Sheet1) and if it's equal to a number of column A of Sheet1 than the script has to copy the corrisponding row of Sheet1 to Sheet2.
What I achieved to do is something like this:
function votazioni() {
var spreadsheet = SpreadsheetApp.getActive();
var activeSheet= spreadsheet.getActiveSheet();
var baseDati= spreadsheet.getSheetByName("Foglio2");
var cellRange = activeSheet.getActiveCell();
var imput= activeSheet.getActiveCell().getValue();
var indiceImput= cellRange.getColumn();
var copiaDati=baseDati.getActiveRange(1,indiceImput).getValue();
for (var i=1; i<1204; i++){
if (imput == copiaDati) {
for( var j=2; j<7; j++){
var copiaValore=baseDati.getRange (j,indiceImput).getValue();
activeSheet.getRange(j,indiceImput).setValue(copiaValore);
}
i=1204;
}
}
}
Sorry for bad english and thank you in advance.