2

I am trying to use the Google Sheet's Script Editor to write a script for a Dependent List using the following script:

function setDataValid_(range, sourceRange) {
  var rule = 
SpreadsheetApp.newDataValidation().requireValueInRange(sourceRange, 
true).build();
 range.setDataValidation(rule);  
}

function onEdit(){
  var pageCell = SpreadsheetApp.getActiveSheet().getActiveCell();
  var pageColumn = pageCell.getColumn();
  if (pageColumn == 6 && SpreadsheetApp.getActiveSheet().getName() == 
'raw_data'){
    var range = SpreadsheetApp.getActiveSheet().getRange(pageCell.getRow(), 
pageColumn + 2);
    var  sourceRange = 
SpreadsheetApp.getActiveSpreadsheet().getRangeByName(pageCell.getValue());
    setDataValid_(range, sourceRange);
  }
}

There are two different tabs I am using in this spreadsheet, "raw_data" and "Range". I had created a drop down list in column F of "raw_data" that lists values from a specified range in "range". Each of these values is also the title of a named range in that tab. The script above is suppose to read the value selected in column F and then two columns over, in column H, create another drop down list based on the values associated with that named range.

The problem I keep having is every time I click run I get the error message "Could not connect to server. Please save and try again" or if I try to set up a project trigger I get "We're sorry, a sever error occured. Please wait a bit and try again".

I have created new spread sheets, recreated the named ranges, created new script files and tried running the script from a separate computer but error message continues.

I haven't been able to find a solution to this and even when I try to use the dubug tool it gives me an error message. Does anyone know what the issue is or how I might resolve this?

BMonty
  • 43
  • 1
  • 6
  • My company is seeing this as well, and searching the web for the error yields enough results to suggest it is something Google is going to need to address on their end. Hopefully enough people paying for G Suite complain about this for it to get fixed. – kungphu Oct 04 '17 at 04:04

4 Answers4

0

I think this may be a legitimate server error at the moment because I'm getting the same error when I try to run any scripts. Same for a co-worker.

Michael
  • 81
  • 9
0

I have tried resaving several copies of my most recent script, all resulting in

Server error occurred. Please try saving the project again.

so I think that this is an issue on Google's side for some reason today. My older scripts are running fine.

0

Just checked the G Suite Status Dashboard and all products seems fine. This page offers performance information for G Suite services. Unless otherwise noted, this status information applies to consumer services as well as services for organizations using G Suite. No issues mentioned on Google's server as of this posting.

In script.google.com:

  1. Resources -> Advance Google Services

  2. Enable Drive API enter image description here

  3. You will be asked to enable it in the Google Dev console. Click the link and enable Drive API. Your script should run as intended now.

Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
0

So I tried the script again this morning and it is working now. Hopefully it continues that way. Thanks for y'alls input!

BMonty
  • 43
  • 1
  • 6