2

As a newbie I am trying to create a Google Form with drop-down lists (in answer to questions), with those lists being obtained from named ranges in a separate google sheet in the Form responses Google workbook.

I have found a script that indicates how to do that but I believe I am coming across a syntax error I can't resolve.

The script gives me an error as:

ReferenceError: "setActiveSheet" is not defined. (line 43, file "Code")

The lines of code are,

42  ss = SpreadsheetApp.getActiveSpreadsheet();

43     setActiveSheet(ss.getSheetByName("DropDownLists"));

DropDownLists is the name of the Google sheet in the Form Returns Google workbook that I am trying to select

I hope someone can help and please be gentle, it's my first request for assistance

Thanks

MathBio
  • 367
  • 1
  • 2
  • 13
  • `ss.getSheetByName("DropDownLists").activate()` does what you want, it sends you to the desired sheet in your browser. – Serge insas Feb 19 '16 at 23:22
  • `sheet.activate()` is a method of the sheet class, it applies to sheet objects. The code below takes it from another side, using the spreadsheet object method. Try using the autocomplete feature in the script editor to help you with that, for info see for example this post : http://stackoverflow.com/questions/35431531/array-push-setanyformattingred/35444381#comment58606600_35444381 – Serge insas Feb 19 '16 at 23:29

1 Answers1

1

setActiveSheet is a method of class SpreadsheetApp (https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app)

Please try changing line 43 to: SpreadsheetApp.setActiveSheet(ss.getSheetByName("DropDownLists"));

  • in this case I would use `ss.setActiveSheet(ss.getSheetByName("DropDownLists")); ` since he already have this `ss` variable which is the active spreadsheet. The method applies to a spreadsheet object, see example in doc https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#setActiveSheet(Sheet) – Serge insas Feb 19 '16 at 23:26