Forked from phillypb/Send data to a Google Form via Apps Script.gs
Created
April 27, 2022 13:55
-
-
Save cwlind/efe5c920efe1c4f542ed514bbc9d07d5 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
Create a prefilled URL for a Google Form with 2 questions on it. | |
*/ | |
function prefillURL() { | |
try { | |
// data to pass to Google Form | |
var shoeSize = 8; | |
var someText = 'The Gift of Script'; | |
// URL of Google Form | |
var formUrl = "ENTER YOUR GOOGLE FORM URL HERE" + "/formResponse?"; | |
// Google Form question ID and relevant data appended | |
var formData = "&entry.ENTER YOUR QUESTION ID HERE=" + shoeSize + "&entry.ENTER YOUR QUESTION ID HERE=" + someText; | |
// combine the above URLs | |
var finalUrl = formUrl + formData; | |
Logger.log(finalUrl); | |
var options = { | |
"method": "post", | |
}; | |
UrlFetchApp.fetch(finalUrl, options); | |
} | |
catch (e) { | |
Logger.log('Error is: ' + e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment