I have a table with 20 rows of data.I want to randomize the data with 10% of the total data.The script I made is like this:
function shuffleSheet() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var range = sheet.getRange('A2:D21'); range.setValues(shuffleArray(range.getValues())); } function shuffleArray(array) { var i, j, temp; for (i = array.length - 1; i > 0; i--) { j = Math.floor(Math.random() * (i + 1)); temp = array[i]; array[i] = array[j]; array[j] = temp; } return array;}
After I run the script, the results are the data is randomized all the data.