Search code examples
google-apps-scriptgoogle-forms

GAS to fill and submit a google form


I need a google form to load new data in to a google spreadsheet (not too hard).

I need the users to validate older data already in a spreadsheet.

My idea was to use the old data spreadsheet to fill the google form and populate the google form's spreadsheet.

I've found the Mogsdad's answer to Kite's question, and tryed the example....

It seems to work as you can see in the execution log:

[15-03-11 11:53:09:468 CET] Avvio dell'esecuzione
[15-03-11 11:53:09:853 CET] UrlFetchApp.fetch([https://docs.google.com/a/xxx.xxx.xxx/forms/d/1_Xvokasdfq1AtMJEEgIw-NKPVY9oEqorEY9-yGi-lvtTY/formResponse, {payload={entry.1075692923=Rossi, entry.1034411028=Mario}, method=post}]) [0,366 secondi]
[15-03-11 11:53:09:854 CET] HTTPResponse.getResponseCode() [0 secondi]
[15-03-11 11:53:09:855 CET] Esecuzione riuscita [0.369 secondi di esecuzione totale]

The http response is 200:successfully:

Logger.log("getResponseCode:" + response.getResponseCode() ); -->15-03-11 13:26:30:884 CET] getResponseCode:200.

but doesn't add any row to the spreadsheet!

whats wrong?

Thanks, Marco


Solution

  • Found the clue!!

    Thanks to user1989's comment to the Brian Frederickson's Question...

    The Google form need to be public!! Because UrlFetchApp doesn't pass any autentication!

    Now i can read data from the input spreadsheet, pass through the google form to fill the output spreadsheet and let the user edit the single lines via google form!!!