The problem you are having is that the spreadsheet contains an item that the form can not find.
Make sure that all your items in the spreadsheet are accurately reflected in the form (upper/lower case sensitive).
You can also add in better handling of the code by adding something like this:
function updateDropdownUsingTitle(title,values) {
var items = form.getItems();
var titles = items.map(function(item){
return item.getTitle();
});
var pos = titles.indexOf(title);
if (pos < 0) {return;}
var item = items[pos];
var itemID = item.getId(pos);
updateDropdown(itemID,values);
}
Pos would be -1 if it can not find it..
From: google-apps-sc...@googlegroups.com <google-apps-sc...@googlegroups.com> On Behalf Of Hartable Solutions
Sent: September 16, 2022 2:52 PM
To: Google Apps Script Community <google-apps-sc...@googlegroups.com>
Subject: [Apps-Script] TypeError: Cannot read property 'getID' of undefined
Hello, I am trying to pull data from one sheet into a google form as a drop down: I keep getting this error: "Error I followed this:
Since I can't share my code well here this is the link to the stackoverflow question I already posed with this problem (I am here because no one was able to answer there)
I have tried changes "lable" to "labels" but I end up with the same error.
Thank you in advance for your help
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/0783d4bd-2166-4e39-bbc1-118e975738c3n%40googlegroups.com.