Created
May 28, 2018 16:52
-
-
Save vhsu/9d2e8765f0868a54daa781096db221d9 to your computer and use it in GitHub Desktop.
Submit a Google Form from App Script (Google Spreadsheet)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://stackoverflow.com/questions/20410497/use-app-scripts-to-open-form-and-make-a-selection?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa | |
// Simulate POST to form | |
function sendHttpPost() { | |
// Copy the entire URL from <form action> | |
var formAction = "https://docs.google.com/forms/d/e/KEY/formResponse"; | |
var payload = { | |
"entry.888888888": "6689898", // Number | |
}; | |
// Because payload is a JavaScript object, it will be interpreted as | |
// an HTML form. (We do not need to specify contentType; it will | |
// automatically default to either 'application/x-www-form-urlencoded' | |
// or 'multipart/form-data') | |
var options = { | |
"method": "post", | |
"payload": payload | |
}; | |
var response = UrlFetchApp.fetch(formAction, options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment