I am trying to pull an item from a Google Form, I believe I have the correct ID's but it keeps returning null.
Here is the snippet of the Google Form that seems to be listing the ID's of the questions:
<div jscontroller="yUS4Lc" jsaction="rcuQ6b:rcuQ6b;UxRBlf:rcuQ6b;">
<div jsname="o6bZLc">
<input type="hidden" name="entry.1246438260" value="">
<input type="hidden" name="entry.1940174151" value="">
<input type="hidden" name="entry.1164498160" value="">
<input type="hidden" name="entry.1788372008" value="">
<input type="hidden" name="entry.1406572509" value="">
<input type="hidden" name="entry.1553787825" value="">
<input type="hidden" name="entry.1660954050" value="">
<input type="hidden" name="entry.2017872929" value="">
<input type="hidden" name="entry.844625047" value="">
<input type="hidden" name="entry.176852728" value="">
<input type="hidden" name="entry.1263452961" value="">
</div>
</div>
And here is my code:
function form (){
var f = FormApp.openById("1q2R07_Ze6M8ltVp_hDH3LMs5iqk6e-2NFad5sS8NAlc");//Google Form ID
var item=f.getItemById(1246438260);//ID of the first Item
Logger.log(item);
}
Thank you for your help
Solved Thank you, problem was solved by logging ID's on the editable form rather than the preview.
ID being used may be incorrect.
You can try getting the list of ids first by using the following code:
function form (){
var f = FormApp.openById("1q2R07_Ze6M8ltVp_hDH3LMs5iqk6e-2NFad5sS8NAlc");//Google Form ID
var item=f.getItems();//Get the IDs of all the items in the form.
for(var i in item){
Logger.log(item[i].getTitle() +" "+ item[i].getId());
}
This will return the list of item ids in the form with their respective item title for your reference on the ids.