Reputation: 1037
Is there a way to get a count of items listed on a google form. For instance I create a google sign-up form for a class my form would look something like below.
function getFormItemCnt(){
var f = FormApp.openById('abcd123kfeofkl-mdsfsd8rferSAFRgdsl')
var formRs = f.getResponses();
var fR = fRs[formRs.length-1];
var iRs = fR.getItemResponses();
for (var j = 0; j < iRs.length; j++) {
var iR = iRs[j];
// Is there a way to get the doing something like below
// var cnt = iR.getItem().getCount();
}
Upvotes: 0
Views: 898
Reputation: 64100
This will give you a dialog with the items index and type.
function myForm()
{
var myForm=FormApp.getActiveForm();
var items=myForm.getItems();
for(var i=0;i<items.length;i++)
{
Logger.log('Item[%s].getItemType=%s',i,items[i].getType());
}
var ui=HtmlService.createHtmlOutput(Logger.getLog());
FormApp.getUi().showModelessDialog(ui, 'Items');
}
Upvotes: 1