I created a form for students to submit their assignments. They copy their URL of the Google document, then paste it in a form. When I get their responses, I can't open their URL, it says I am not granted access. I checked the form and I am the owner and have access. What do I need to do?
Google-forms – Access to a Google form once people have used it
google-forms
Related Solutions
You will need to use Google Apps Script and to use the old Google Forms as the new one doesn't include yet a way to add the following script.
To add the script,
- Open the form in the form editor.
- Go to Tools > Script Editor.
- Paste the below code.
- Save the project and give a name to it.
- Run once time to authorize it.
Note: The original code included a line to add the link to edit the response. That line was converted to a comment to meet the requirements stated in the question.
// Adaptation from http://securitasdato.blogspot.mx/2014/11/sending-confirmation-emails-from-google.html
function setup() {
/* First, delete all previous triggers */
var triggers = ScriptApp.getProjectTriggers();
for (var i in triggers) {
ScriptApp.deleteTrigger(triggers[i]);
}
/* Then add a trigger to send an email on form submit */
ScriptApp.newTrigger("sendConfirmationEmail")
.forForm(FormApp.getActiveForm())
.onFormSubmit()
.create();
}
function sendConfirmationEmail(e) {
// e is a Form Event object - see https://developers.google.com/apps-script/guides/triggers/events#google_forms_events
// Edit this to set the subject line for the sent email
var subject = "Registration Successful";
// This will show up as the sender's name
var sendername = "Your Name Goes Here";
// This is the body of the registration confirmation message
var message = "Thank you for registering.<br>We will be in touch.<br><br>";
message += "Your form responses were:<br><br>";
// response is a FormResponse - see https://developers.google.com/apps-script/reference/forms/form-response
var response = e.response;
var textbody, sendTo, bcc;
// Get the script owner's email address, in order to bcc: them
bcc = Session.getActiveUser().getEmail();
// Now loop around, getting the item responses and writing them into the email message
var itemResponses = response.getItemResponses();
for (var i = 0; i < itemResponses.length; i++) {
var itemResponse = itemResponses[i];
message += itemResponse.getItem().getTitle() +": " + itemResponse.getResponse() + "<br>";
// If this field is the email address, then use it to fill in the sendTo variable
// (Optional) Check that your form item is named "Email Address" or edit to match
if (itemResponse.getItem().getTitle() == "Email Address") {
sendTo = itemResponse.getResponse();
}else{
// If the form don't ask the respondent email address use the following one
sendTo = 'sendconfirmationemail@googlegroups.com'; //replace this email address by your own default email address.
}
}
// The following line was commented in order to avoid to include the link to edit the response
// message += "<br>If you wish to edit your response, please click on <a href="\""" +="" response.geteditresponseurl()="" "\"="">this link</a>.";
message += "<br><br>";
textbody = message.replace("<br>", "\n");
GmailApp.sendEmail(sendTo, subject, textbody,
{bcc: bcc, name: sendername, htmlBody: message});
}
Reference
Yes, it's possible, but with slight different approach:
Submit one answer for each respondent in order to get one edit URL by each of them, then send the corresponding URL to each respondent.
Below is a code snippet that programmatically submits a response and log some response attributes including the edit response url by two methods, the first one has an issue, the second one is a workaround.
It will work as a stand alone or as a bounded script.
/*
This code shows how to get the edit response url of a
programmatically submitted response to a Google Form
*/
// Replace the form ID by your own form
var formID = '1234567890abcdefghijklmnopqrstuvwxyz';
function myFunction() {
var form = FormApp.openById(formID);
var response = form.createResponse();
var items = form.getItems();
var item = items[0];
if (item.getType() == 'TEXT') {
var textItem = item.asTextItem();
var itemResponse = textItem.createResponse('my text');
response.withItemResponse(itemResponse);
}
// Submit response
var submittedResponse = response.submit();
// Get submitted response attributes
var values = {
ID : submittedResponse.getId(),
TS : submittedResponse.getTimestamp(),
/*
Issue 4476: FormApp: getEditResponseUrl() produces invalid URL
https://code.google.com/p/google-apps-script-issues/issues/detail?id=4476
*/
ER1 : submittedResponse.getEditResponseUrl(),
/* Workaround from
https://code.google.com/p/google-apps-script-issues/issues/detail?id=4476#c2
*/
ER2 : submittedResponse.getEditResponseUrl().replace(
/\?edit2=.*/,"?edit2=" + submittedResponse.getId()
)
};
Logger.log(values);
}
References
Related Topic
- Google-forms – How to connect different questions in forms to one column in the responses
- Google-forms – Edited Google Form while users were responding – how to recover initial responses
- Google-docs – Google Docs form attachments
- Google-drive – How to find out who created a Google Form
- Google-forms – Google Forms/ Sheets
- Google-sheets – copy a google form retaining responses and summary charts
Best Answer
It sounds like you have two different Google Documents. You have the Google Form that you created and the Google Document that each of your students created with their work.
You have permission to your own Google Document form. But you need permission to access your students' Google Documents work product. Just because you have the link to your students' Google Documents doesn't mean you have permission to access them.
Your students need to change the permissions on their Google Documents. Your students need to click on the "Share" button in the top right section of their Google Document, and add your email address to the "Invite people:" field.