简体   繁体   中英

Google Scripts - Google Forms - Get Strings of Items

I am having some difficulty capturing the names of the items within my Google Form. I want to be able to store the form item names to then be used with if/else statements to better filter my responses. I am able to get the number of items within my form, but cannot pull the names of those form items. Can anyone help me figure out what method I'm missing?

  //Capture Questions 
  var items = form.getItems();

  //Capture Question Titles, Provides # of items in "[items, items, ...]" format
  var itemsTitle = items.toString();

//Does nothing
var titles = itemsTitle.getTitle();

.getTitle() has to be called on an item object , not a string:

for ( var i in items ) {
  var title = items[i].getTitle()
}

or items[0].getTitle() if you know the exact index of the item

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM