Created
March 12, 2021 12:49
-
-
Save phillypb/d600a72cec0285dc073ca9827505b0f9 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