Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phillypb/d600a72cec0285dc073ca9827505b0f9 to your computer and use it in GitHub Desktop.
Save phillypb/d600a72cec0285dc073ca9827505b0f9 to your computer and use it in GitHub Desktop.
/*
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