0

I'm new to Google Apps Script and I'm having the following issue :

I have created a Google Form which I will send to some end user for them to complete. However, in one of these fields, there's a huge dropdown list of every city in my state (to simplify). I don't want to maintain either to fill this dropdown nor maintain it, this is why I'm looking for a way to populate this very dropdown with datas from a column in another spreadsheet I created.

And this is where I'm stuck. I don't even manage to log an "Hello world" because I can't seem to understand how any of this works.

I have opened the script editor from within the Google Forms editor and added this very basic code :

function onOpen(e){
  var form = FormApp.getActiveForm();
  var items = form.getItems();
  for (var i in items) { 
    Logger.log(items[i].getTitle() + ': ' + items[i].getId());
  }
}

What I understand is that my app script is automatically connected to my google forms and so this code should run everytime any end user opens up the form.

That would be amazing if you could tell me what I'm doing wrong or even tell me what I didn't understand...

Thanks a lot !

user2377141
  • 132
  • 12
  • *code should run everytime any end user opens up the form.* No. It'll run only when a editor opens the form for editing. See duplicates above – TheMaster Sep 08 '20 at 14:30
  • thanks for your answer. this means one has to feel his spreadsheet then click the edit button for the form to update accordingly. there is no way to automate it... or maybe I can from within the spreadsheet. it will try that. thanks again ! – user2377141 Sep 08 '20 at 16:16
  • There is no trigger when user opens the form. That's all. There are other triggers notably time triggers – TheMaster Sep 08 '20 at 16:20
  • Ok. Thanks you. If any of you need to perform what I intended don't mind asking me at nath dot peix dot ytb at gmail dot com – user2377141 Sep 09 '20 at 14:17
  • This question is rather similar to https://stackoverflow.com/questions/30388208/ You could just share what you want as a answer there – TheMaster Sep 09 '20 at 14:38

0 Answers0