ming
ming

Reputation: 11

getValue() suddenly not working for a particular sheet

I have a script on a sheet with several editors which was working just fine a few days ago. However, it started to time-out when i tried it today. I narrowed down the problem to the function call getValue(). the code is as follows:

1 function testGetIdFromUrl() {
2    var sheet = SpreadsheetApp.getActiveSheet();
3    Logger.log(sheet);
4    var range = sheet.getRange("F6");
5    Logger.log(range);
6    var thevalue = range.getValue();
7    Logger.log(thevalue);
8 
9    Logger.log("The ID is : " + getIdFromUrl(thevalue))
10
11 }

on the logs, it shows that the last log is from line 5, where it shows 'range'; the log reads like this:

[18-07-02 12:08:38:350 HKT] Sheet
[18-07-02 12:08:38:352 HKT] Range 

The execution transcript is:

[18-07-01 23:21:26:532 PDT] Starting execution
[18-07-01 23:21:26:546 PDT] SpreadsheetApp.getActiveSheet() [0 seconds] 
[18-07-01 23:21:26:548 PDT] Logger.log([Sheet, []]) [0 seconds] 
[18-07-01 23:21:26:549 PDT] Sheet.getRange([F6]) [0 seconds]
[18-07-01 23:21:26:550 PDT] Logger.log([Range, []]) [0 seconds]
[18-07-01 23:27:36:835 PDT] Range.getValue() [370.285 seconds] 
[18-07-01 23:27:36:841 PDT] Execution failed: Exceeded maximum execution time [370.294 seconds total runtime]

When I create a copy of the same sheet and run the script, it works perfectly fine.

Similarly, if instead of running getValue() from a range on the current sheet, I reference another sheet instead, I am able to call getValue() to get values from any other sheet.

No changes were made to the permissions or any protected ranges in the sheet. Since the last time I touched it. The owner of the same spreadsheet is unable to run the script as well.

Any ideas what could be going wrong?

Upvotes: 1

Views: 1011

Answers (1)

lalala
lalala

Reputation: 71

The same happened with my code too. I tried reloading the sheet associated and the script. After which, I tried it with an incognito tab which then worked fine. Try reloading or opening a new browser and try it.

Upvotes: 1

Related Questions