0
votes

I am newbee in google apps script. So I learned how to code some functions in Sheets. But may Google Form use data from Sheet with answers? So I think to create calculator. When I debug code in script in "Sheet with answers from Form" everything works fine. But I don't know how this script become workable when I create this code in script in the Form. Please help me. I want that after user press button "Send form" he get browser window with value from cell from "the Sheet with answers from the Form".

My code:

function sendFormByEmail(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Ответы на форму (1)");
  var rows = sheet.getLastRow();
  var cols = sheet.getLastColumn();
  var sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Лист4");
  var values = sheet2.getRange(rows, cols+1, 1, 1).getValue();
  Browser.msgBox("Your value: " + values + " $");  
}
1
This doesn't work since the onFormSubmit trigger runs as you and not the user submitting the form. The only way of doing something like this is to build a custom form in apps script. - James D

1 Answers

0
votes

Sadly, this is not possible at the moment using Google Forms.

There is currently no way of issuing a dynamic response to the form user.

If you are still interested in the possibility of doing such a thing, I suggest you check out Google Apps Script WebApps, that will allow you to implement this functionality (although will also require more work).

The idea is that:

  • You create an HTML form that can be retrieved from the Browser through the doGet() function.
  • The form submits a POST request with all the user's data, which is handled by the doPost() function. This function inserts the data into your Sheets document by means of the SpreadsheetApp class, and returns an HTML response containing the response value.