2

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); 

 }
Rubén
  • 34,714
  • 9
  • 70
  • 166
George J
  • 51
  • 1
  • 7
  • 1
    Possible duplicate of [How do you open a Google form from a Custom Menu Item](http://stackoverflow.com/questions/26815296/how-do-you-open-a-google-form-from-a-custom-menu-item) – Rubén Mar 08 '17 at 00:07

2 Answers2

1

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.

JPV
  • 26,499
  • 4
  • 33
  • 48
  • Is there a command to view the form or could you point me in direction of any scripts to view existing forms – George J Mar 07 '17 at 13:33
1

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

Rubén
  • 34,714
  • 9
  • 70
  • 166