I have a written a function to create reports:
- Detect if there's a specific letter in a specific range (function asks user for letter and column)
- Grabs the entire row if it has the letter.
- Copies it to another sheet.
My code is currently working, but it takes ages to finish. Also, if I have more than hundreds of results, I get a timeout issue.
You can reproduce the issue here:
https://docs.google.com/spreadsheets/d/1ggVvxquruYfckNWxhsV6-Od2J8QIkMOYpJps7qz9PkI/edit?usp=sharing
This is the code:
for(var i = 0; i<rapport.length-1; i++) {
if(colonneCode[i] == code.getResponseText()) {
ligneCode[v] = i;
v++;
}
}
for(var i = 0; i<ligneCode.length;i++) {
var codeLastRow = 12;
var copySource = sheet.getRange(ligneCode[i]+10, 1, 1, 16);
var copyTarget = feuille.getRange(feuille.getLastRow()+1,1,1,16);
copyTarget.setValues(copySource.getValues());
copySource.copyTo(copyTarget, {formatOnly:true});
}
Click on the personalized menu (évaluations Philippe Caron) -> Classement personnalisé -> First input box "2" -> Second input box "e" -> Third one is the name you want the new sheet.
See Question&Answers more detail:os