So I have a sheet as seen here. https://docs.google.com/spreadsheets/d/1r2ogg1ldR0CFjOJ6mVObY-WRVipJx_X3pQ0yM2HYEog/edit?usp=sharing.
I am trying to write a script that goes through every row in range A1:D and chooses one random cell to put in the F column of the same row.
I am new to GAP so Im not sure how to write the exact script for that. This is what I got so far
function random() {
var sss = SpreadsheetApp.getActiveSpreadsheet();
var ss = sss.getSheetByName('Sheet1'); //the sheet that has the data
var range = ss.getRange('A1:D'); //the range I need
var data = range.getValues();
for(var i = ; i < data1.length; i++) { //at this point im just guessing based on online codes
= Math.floor(Math.random()*(j+1)); //method of randomization
ss.getRange('the i row of F column').setValue(data[i][1]); //choosing the row that is being used, selecting the first item of the shuffled array
};
}