George J
George J

Reputation: 61

Nothing Happens when i use FormApp.openById

I am trying to load an existing google form from a spreadsheet using the simple example that create a custom menu and should load a form ready to add new responses

when i save the function i am prompted to Allow permissions which i do . When i run the script - i dont get any messages but nothing happens. The form doesn't load . I thought the formapp command actually loaded the form

Is there a command to view the form or could you point me in direction of any scripts to view existing forms?

here is the script - am i missing something ?

`function launchForm() {

 var ui = SpreadsheetApp.getUi();
 // Or DocumentApp or FormApp.
 ui.createMenu('Custom Menu')
   .addItem('Open a form ', 'menuItem1')
  .addToUi();
 }

 function menuItem1() {

 var formID = '13hmg8VQgYHjrzgrPp33FQU6P3I4p5tFZvOs3p2T_xSc';
 var form = FormApp.openById(formID); 

 }

Upvotes: 2

Views: 956

Answers (2)

Wicket
Wicket

Reputation: 38190

Google Apps Script can't open forms on the web browser, instead you have to manually click on the Google Form URL.

Upvotes: 1

JPV
JPV

Reputation: 27262

The form is only 'programmatically' opened (so that the code has access to it). Do not expect a google script command to 'physically' open a form.

Upvotes: 1

Related Questions