The spreadsheet that I am using at work is getting slower and slower. The choice for a kind of (GAS) scripting might be a reason for that.
Three options to get the values of a sheet in a Google Spreadsheet.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| function slowSlowerSlowst(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("XXXXX");
var rangeGetLast = sheet.getRange(1,1,sheet.getLastRow(),sheet.getLastColumn());
var dataGetLast = rangeGetLast.getValues();
var rangeGetDataRage = sheet.getDataRange();
var dataGetDatarange = rangeGetDataRage.getValues();
var rangeGetMax = sheet.getRange(1,1,sheet.getMaxRows(),sheet.getMaxColumns());
var dataGetMax = rangeGetMax.getValues();
}
|
The results are a kind of shocking
The first option takes 47,984 seconds (4,637 + 21,05 + 22,297).
The second option takes 68,623 seconds (48,01 + 20,613).
The third option takes 22,597 seconds.
Another try.
The first option takes 57,701 seconds (15 + 20,689 + 22,0).
The second option takes 60,701 seconds (40,408 + 20,293).
The third option takes 21,297 seconds.
Since I am using a 'anchor' cell to get acces to a row in my Google Spreadsheet empty rows and columns are not a issue.
I do not understand why the moment of executing a script makes difference.