I have a script that used to run in well under a minute. Recently I started getting "Exceeded maximum execution time" errors indicating it now breaks the 6 minute limit.
Using 'Execution transcript' I found that the few getValue() and getValues() calls I make take very long time, so I experimented.
The following test function takes anywhere from 3 to 7 seconds to execute:
function test_singleCellRange_getValue() {
var sheet = SpreadsheetApp.getActive().getSheetByName('Marcin');
var range = sheet.getRange(1, 1);
var value = range.getValue();
}
The 'Execution transcript' shows that the getValue()
call takes all the time:
[17-10-29 14:15:00:002 EDT] Starting execution
[17-10-29 14:15:00:019 EDT] SpreadsheetApp.getActive() [0 seconds]
[17-10-29 14:15:00:074 EDT] Spreadsheet.getSheetByName([Marcin]) [0.054 seconds]
[17-10-29 14:15:00:075 EDT] Sheet.getRange([1, 1]) [0 seconds]
[17-10-29 14:15:07:377 EDT] Range.getValue() [7.301 seconds]
[17-10-29 14:15:07:381 EDT] Execution succeeded [7.36 seconds total runtime]
The single cell contains a constant string value (i.e. no formulas). Is this dismal performance of getValue() normal (i.e. the new performance standard to expect from Google's servers), or is there something I can do to improve performance?
Update
Performance of getValue()
appears to be heavily impacted by the size of the spreadsheet. Even though the above code executes getValue()
on a single cell range its performance appears to be impacted by the overall size of the spreadsheet.
This makes no sense - anyone has experience here? Is this how Google designed the API or is this a bug?