Edit Form Responses In Google Forms

Google Forms Tips - Edit Responses
Do you need to have someone edit form responses AFTER they’ve already submitted them? What if they closed the form and need to edit later? If this is something you’re dealing with, then this article is where you need to be!

Edit Form Responses After They’ve Been Submitted

I recently had a student ask me how he could have people come back to his form and edit their responses. In this article we’ll take a look at how to set up a form that can immediately be edited, as well as how we can get the link for editing a form that has already been closed.

Method 01 – Including the Edit Response Link

For the first method, we’ll simply set the form to include an ‘edit response’ link after the form is submitted.

To do this, click on the settings icon in the upper right.

Google Forms - Edit Responses - 01

Then check the “Edit after submit” box, and save it.

Google Forms - Edit Responses - 02 Edit Check Box

Now you can preview the form and fill it out. Once you submit the form, you will see that there is a link to edit your response.

Google Forms - Edit Responses - 03 Edit Link

Clicking on that link will bring the form back up to edit. If you have a need for people to come back to the form and edit it later, you can tell them to copy this edit form link and save it somewhere.

That’s a simple way to do it. Now what about the people who have already filled out a form and closed it, but need to go back and edit their response? This is a bit more complex to set up, but once it’s done you can use it over and over.

Method 02 – Retrieving the Form Edit Links

For this method, you’ll set up a script in the response spreadsheet that will insert the edit form links for each response.

Begin by linking your form to a response spreadsheet. This is done by clinking on the “Responses” tab, then clicking on the green spreadsheet icon.

Google Forms - Edit Responses - 04 Link Spreadsheet

Once that is done, open the spreadsheet and click on the Tools menu item then Script Editor.

Google Forms - Edit Responses - 05 Script Editor Menu Link

This will open a new tab with the Google Script Editor.

Set up the script

Delete the text that’s already there and replace it with this script:

function assignEditUrls() {
var form = FormApp.openById('Your form key goes here');
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Your responses Google Sheet name goes here - The tab name, not the file name');
var data = sheet.getDataRange().getValues();
var urlCol = Column number where URLs get entered goes here;
var responses = form.getResponses();
var timestamps = [], urls = [], resultUrls = [];
for (var i = 0; i < responses.length; i++) {
timestamps.push(responses[i].getTimestamp().setMilliseconds(0));
urls.push(responses[i].getEditResponseUrl());
}
for (var j = 1; j < data.length; j++) {
resultUrls.push([data[j][0]?urls[timestamps.indexOf(data[j][0].setMilliseconds(0))]:'']);
}
sheet.getRange(2, urlCol, resultUrls.length).setValues(resultUrls);
}

*You can also find the code in this shared Google Doc: 
https://docs.google.com/document/d/1m9V_AHZdA24pUAR1xGxQNt_y3k7J9RKoSG5v_9oFvcU/edit?usp=sharing

The red text is what you need to update with information relevant to your form.

The first thing you need to update is the form key. Looking at the form, you’ll see a string of numbers and text in the URL. This is what you need to copy, and paste into the script where it says, “Your form key goes here“.

Google Forms - Edit Responses - 06 Form Key

Next you’ll need the the sheet name. This is referring to the sheet that your responses are stored on, not the file itself. Copy the sheet name and paste it into the script where it says, ” Your responses Google Sheet name goes here – The tab name, not the file name“.

Google Forms - Edit Responses - 07 Sheet Name

The last thing you’ll need to do is tell the script what column should contain the edit URLs. In this example, the next empty column in this spreadsheet is the sixth one, which means I would enter “6” for the column. You can enter any empty column number you like. Make sure not to accidentally delete the semi-colon. If you do, the script won’t work.

Google Forms - Edit Responses - 08 Column Number

Run the Script

Once you’re done entering your form information, you can save the script. If you haven’t already, give it a name that relates to your form. Now you just need to run the script by clicking on Run,> Run Function > assignEditURLs

Google Forms - Edit Responses - 09 Run Script

The first time you run the script, it will tell you that Authorization is required. Click on “Review Permissions”, choose your account and click on “Allow”. You may get one more warning about safety. If you do, you still want to allow it. You made the script, so you know it’s safe.

When you go back to the spreadsheet you will see that the URLs have been populated in the column that you designated. If you open one, it will take you directly to the form for that response and allow you to edit it.

Google Forms - Edit Responses - 10 Populated Cells

After you’ve set this up, all you need to do is run the script any time you want to populate the URLs. You now have the edit URLs to give out to the people who filled out you form if they need to edit them.

PLEASE NOTE – I realize that in the video I’m copying the FormKey from the form’s preview. Make sure that you are using the FormKey from the form while in Edit Mode, not from the preview.

IF YOU DON’T – You will see an error that looks something like this, “TypeError: Cannot read property ‘getSheetByName’ of null (line 4, file “Code”)”

Watch the Video

Watch the video on how to edit form responses in Google Forms to see it in action.

I hope you found this article to be helpful. Comment below to and let me know what you think.

Learn more about Google’s amazing office apps with the best selling Google Cloud Productivity course on Udemy.

108 Comments

  1. Jay on July 26, 2018 at 4:35 am

    Great article, worked perfectly. Thank you!

  2. Frank on September 7, 2018 at 12:42 am

    Thank you for tutorial. It works.

  3. Raj on September 7, 2018 at 10:13 pm

    THANK YOU!!! Worked!!!!!

  4. Primoz on October 3, 2018 at 6:52 am

    Thanks Joe, this is helpfull.

  5. Contributing Author on October 11, 2018 at 11:04 am

    After run, I am getting an error that says, Invalid ID (line 2, file “Code”). I copied and pasted the Form Key so I know there is not a typo. My Form Responses are linked to an existing spreadsheet. Is that problematic?

    • Cinnamon Green on October 22, 2018 at 5:37 pm

      I’m receiving this error as well. Need help :-/

    • Kara on January 27, 2021 at 8:04 am

      Me as well. How did you fix?

  6. Contributing Author on October 11, 2018 at 1:04 pm

    Figured out what I did wrong. I was entering the Form ID of the response form, when I should have been entering the Form ID of the Google Form in edit mode itself. After that the script worked perfectly. TY

    • Joe Buchmann on October 11, 2018 at 3:25 pm

      Awesome! I’m glad you were able to get it resolved 🙂 Sorry it took me so long to respond.

      • Mishelle on November 16, 2018 at 3:52 am

        The form key picture/screenshot above is showing that the key should be copied from preview mode and not in edit mode (because you can see in the picture “viewform” at the end of the url). I had the same issue at first because I did not know that the key had to be taken from edit mode (I was going by the pictures).

  7. Cinnamon Green on October 22, 2018 at 5:34 pm

    I am not able to get this to work – not sure what I am doing incorrectly. When I use the form id (edit mode) it runs I don’t get an error, and it appears to run through, however, the links do not populate in the spreadsheet. Please HELP.

  8. Cinnamon Green on October 22, 2018 at 5:36 pm

    I am not able to get this work. When I use the form id (edit mode), I do not receive the error, but it appears to run. When I go to the spreadsheet, the new field/links do not appear. I’m not sure what I’m doing wrong. PLEASE HELP. Thank you.

  9. Laura on November 6, 2018 at 12:27 pm

    I am getting an error “TypeError: Cannot call method “getDataRange” of null. (line 4, file “Code”)” help?

    • Leona on May 8, 2019 at 10:04 am

      It probably means you spelled the form tab name incorrectly. I had the same issue and that ended up being the source.

      • ATSiem on February 1, 2020 at 3:37 pm

        I am having the same issue, and I have not incorrectly types the single word tab name: ‘Responses’. I also tested the same name as in the original code ‘Form Responses 1.’ This worked on my first ‘Run’ (after I ensured my Timestamp column was in Position 1 and my urlCol was set to 2) and has failed every time since.

    • Mike Myers on September 3, 2020 at 5:14 pm

      I am having the same issue. I have not misspelled or inserted any extra spaces. I copy and pasted the tab name.

  10. Alex on November 8, 2018 at 5:32 am

    Thank you for this awesome script… I needed a while to figure it out: You should mention that one should not modify the position of the timestamp column. I inserted a column as the first column where I wanted to put the urls which will not work as the timestamp column is hardcoded. I suggest changing it this way:
    // Column number of timestamps (default: 1)
    var timestampCol = 1;
    // in the second loop
    resultUrls.push([data[j][timestampCol-1]?urls[timestamps.indexOf(data[j][timestampCol-1].setMilliseconds(0))]:”]);

    • lydio on July 30, 2019 at 7:08 pm

      didn’t work with me….put the full script, please. thanks

  11. Glenn on November 28, 2018 at 10:17 am

    How do we get the script to run automatically? I can’t go in and run the script all the time.

    • Joe Buchmann on November 28, 2018 at 2:30 pm

      Unfortunately, there isn’t an automatic way to run the script.

      • Glenn on November 29, 2018 at 6:43 am

        After a little digging I discovered Google script triggers! These are great. Allowed me to set a trigger to run the script on form submission. Perfect!

        • Joe Buchmann on November 30, 2018 at 1:42 pm

          That’s awesome! Good find 🙂

        • suateng boy on January 9, 2019 at 4:01 pm

          can you please show how to change the trigger please? Thank you.

          • Glenn Wilkins on February 22, 2019 at 12:12 pm

            It may only be available to GSuite customers.
            https://script.google.com/home



          • morndew157 on February 19, 2024 at 8:02 am

            Changing the trigger for the script is super easy. When you have the app script open, on the left are 6 icons. The 4th one down is “triggers”. Select that, then click “create trigger”. In the box that pops up, you only need change the bottom item “select event type”. Change that to on form submit and you’re all set.



  12. Arlene on December 4, 2018 at 12:23 am

    Hi got an error in running the script “TypeError: Cannot find function setMilliseconds in object 18-00001. (line 13, file “Code”)Dismiss”

    • Wing on January 9, 2020 at 6:08 pm

      Same Error..

  13. Donald on December 12, 2018 at 12:35 pm

    Hi Joe, im getting this error message while I tried to run the above script: “No item with the given ID could be found, or you do not have permission to access it. (line 2, file “Code”

    • Teresa on February 2, 2021 at 9:54 pm

      Yes! Same here. Looking for help. Mine says:
      Exception: No item with the given ID could be found. Possibly because you have not edited this item or you do not have permission to access it.

      • Teresa on February 2, 2021 at 9:55 pm

        Let me know what you find out.

        • Dell on April 24, 2021 at 3:37 am

          I got the same error earlier and I found out the culprit is the setting in the Form must tick the checkbox on “Edit after submit”.

      • Alisa Mosley on June 8, 2021 at 8:52 am

        I had the same problem. I was using the form Key ID from the edit response link, not the edit form itself. When I opened the edit form, the Key ID changed and solved the issue

  14. Scott on December 21, 2018 at 3:42 pm

    I have had this running for a couple of years now and all of a sudden, I’m getting a page that pops now that says “You cannot edit your response”. I’m the owner of the page and I can’t figure out what’s causing this. Any ideas?

  15. Jason on February 20, 2019 at 7:20 pm

    Hi there!
    Loved the help, worked in the most part except for a few ‘undefined’ cells.
    Can anyone help me with this?
    Cheers

  16. Zahra on February 22, 2019 at 11:50 am

    This was awesome. I am not much of an script-er, but the instructions were so clear and complete, that it worked flawlessly on my first try. Thanks

  17. Boutte59 on February 25, 2019 at 6:48 am

    Hi Joe,
    Great idea however it populate with the same link for all rows which means that I cannot access to each record for updating them.

    What I did wrongly?

  18. jayr on March 1, 2019 at 4:12 am

    i have an error saying ” no item with the given id could be found ” how do i resolve it..i already allow the script to run

  19. Laurente A. Samala on March 4, 2019 at 1:47 am

    It works perfectly well for me. However, my form was designed so that users can add files (documents, spreadsheets, pdf, images, etc.). Is there a way to replace these files when editing the form? Thank you very much.

  20. Kendra on March 11, 2019 at 4:13 pm

    When I run the script and it asks for authorize and I click Review Permissions, the pop-up window disappears but nothing happens after and the script does not appear to run. Any suggestions?

  21. Matt on March 18, 2019 at 5:51 pm

    This is awesome!!!!!!!!!!!! Thanks

  22. Sarah Mould on March 19, 2019 at 3:22 am

    Thank you – useful code!

    Is it wise to always rewrite all the response urls for the sheet? If, say, I email the user with their response url, and they make changes – is there any possibility of the url changing? Assuming not, and there are many responses, this may be a slow process. Won’t it be better to just enter the url for the just-submitted response, using a trigger?

    • Joe Buchmann on March 19, 2019 at 12:34 pm

      If I’m understanding you correctly, no, the url will not change. Unless something has changed, the edit url should remain the same for each user so they can go back and edit as many times as necessary.

  23. Siddharth Rai on March 23, 2019 at 7:26 am

    I am getting this error

    This app isn’t verified
    This app hasn’t been verified by Google yet. Only proceed if you know and trust the developer.

    If you’re the developer, submit a verification request to remove this screen. Learn more

    please help.

  24. Rich Novy on April 23, 2019 at 10:28 am

    Hello, I am not sure what happened but I used this script once and it worked perfectly. Now I keep getting an error code. The number of rows in the range must be at least 1. (line 15, file “Code”) for this line sheet.getRange(2, urlCol, resultUrls.length).setValues(resultUrls); Please help.

  25. Jess on May 16, 2019 at 12:35 pm

    worked the first time… second time im getting this …… TypeError: Cannot find function setMilliseconds in object . (line 17, file “Code”)

  26. Sam on May 22, 2019 at 7:01 am

    I am receiving the same TypeError message as Jess (above). It also worked the first time for me.

  27. MW on May 23, 2019 at 5:01 pm

    This is awesome, BUUUUTTTT I am having a problem now. The links would populate without any issue. IT worked!!!

    Now, I run the same script and I am getting an “undefined” entry where I would normally have the links.

    Does anyone have any idea why this is happening? Any help would be appreciated.

    TY in advance.

  28. Pierre on May 28, 2019 at 6:14 am

    Hi, with this script populating the link Edit URL to the Result page, when a user want to edit his data, will he also have access to other people entries?

    Thank you! Great job!

  29. Glenn Wilkins on May 28, 2019 at 11:48 am

    Yes, that is the way it works for me.

  30. Prachi on June 19, 2019 at 8:42 pm

    Hi can you please provide the edited code if timestmap is not in the first column and lets say in 15th column

  31. Marlese on July 17, 2019 at 3:47 am

    Thanks, this was hugely helpful

  32. Ron Ruble on August 29, 2019 at 7:24 pm

    Fantastic, works just great!

  33. shellyd6477Michelle on December 9, 2019 at 7:06 pm

    Is there a way to remove/hide the warning in the bottom corner of the form that reads, “You’re editing your response. Sharing this URL allows others to also edit your response?”

  34. Aimee on December 10, 2019 at 8:55 pm

    Hi! Great script; it’s working perfectly! But is there a way to replace the actual edit response links in the worksheet with something like “Edit”? This way it just looks a little cleaner.

  35. Glenn Wilkins on December 11, 2019 at 5:09 am

    You can use the ‘HYPERLINK’ function in another cell. You can even use special characters like a pencil to imply ‘edit’. I also use the ‘eyes’ special character to imply ‘view’ for the PDF that I generate for the form that is created by the form. I don’t touch anything in the form output tab of the sheet. I’m afraid of messing it up. So I create another tab or another sheet and just reference the information from the form output tab. That’s when I use the ‘HYPERLINK’ function. I create a spreadsheet and format it to look real night and then publish it as a web page on our Google Site. People can go to the site, there is a link for the form, then can fill it out, then there is the spreadsheet which lists all the information about all the data in the spreadsheet, and a the hyperlink to edit the form if they need to. Works real slick.

    • Aimee on December 12, 2019 at 4:12 pm

      Excellent, thank you for the thoughtful response, Glenn! Works like a charm!

  36. gancw1 on March 9, 2020 at 8:43 pm

    Why do I get this error “TypeError: Cannot read property ‘getSheetByName’ of null (line 4, file “Code”)” i have copied and pasted the tab nameso the tab name is correct.

  37. John Fritz on March 15, 2020 at 7:08 pm

    I have “sign in required” set up on my form, which requires my university’s SSO login. So, will the script only allow the original form author to edit his or her response? Or will all authenticated users who have submitted a response be able to see (and edit) other users’ submitted responses?

  38. David Hansford on March 25, 2020 at 4:47 am

    Here are simple bugs you might encounter and their solutions:

    Error: Exception: Invalid ID (line 2, file “Code”)
    Solution: Line 2: Your form ID is taken from the URL of your form in edit mode (not your sheet of responses!)
    Example: https://docs.google.com/forms/d/*form-id-is-here*/edit

    Error: ReferenceError: B is not defined (line 7, file “Code”)
    Solution: You need to reference the column where you want your links to be inserted as a number, not as a letter. If you want your links in column B, the column number is 2. Column C is 3 etc
    Example: var urlCol = 2;

    Error: TypeError: data[j][0].setMilliseconds is not a function (line 17, file “Code”)
    Solution: This code looks for timestamps in Column A (ignoring the column title), if it finds anything in this column that isn’t a timestamp the code generates an error and fails before inserting the edit links into your sheet. Simply delete anything in column A that isn’t a timestamp output from your google form.

    • mariosoa on July 7, 2020 at 4:38 pm

      You saved me! Thank you!!! I had bug number 3 🙂

    • Jason on May 4, 2021 at 6:04 am

      Brilliant, 3rd error left me bamboozled, but your fix worked perfectly.. Thank you soo much!!

  39. matt on March 30, 2020 at 8:17 pm

    getting a strange error from google when i run it “Sign in with Google temporarily disabled for this app
    This app has not been verified yet by Google in order to use Google Sign In.” i followed the directions exactly and sign in with my gmail account when asked for it. ideas?

  40. GOOT on May 7, 2020 at 9:29 am

    Getting this error: Exception: The number of rows in the range must be at least 1. (line 15, file “Code”).

    How do I fix this?

    • Joe Buchmann on May 7, 2020 at 11:43 am

      Make sure that you are using the FormKey from the form while in Edit Mode, not from the preview. See if that helps.

      • Steven on June 14, 2020 at 11:20 pm

        I am getting the same error, any help would be much appreciated. I am using the FormKey while in edit mode.

        function assignEditUrls() {
        var form = FormApp.openById(‘1ZouqB3LFbvaRwoBEiiREQlk8IDogT_SgWDDM3WC730s’);
        var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(‘Form Responses 1’);
        var data = sheet.getDataRange().getValues();
        var urlCol = 19;
        var responses = form.getResponses();
        var timestamps = [], urls = [], resultUrls = [];
        for (var i = 0; i < responses.length; i++) {
        timestamps.push(responses[i].getTimestamp().setMilliseconds(0));
        urls.push(responses[i].getEditResponseUrl());
        }
        for (var j = 1; j < data.length; j++) {
        resultUrls.push([data[j][0]?urls[timestamps.indexOf(data[j][0].setMilliseconds(0))]:'']);
        }
        sheet.getRange(2, urlCol, resultUrls.length).setValues(resultUrls); }

        • Kim on October 5, 2020 at 4:31 pm

          I was getting the same error message until I populated the spreadsheet with a sample response. Then it worked perfectly!

          • German A. on July 31, 2021 at 5:39 pm

            I can confirm this! I was getting an error message because it was still blank. But once you’ve had a response, it will work. 🙂



  41. Ren on May 10, 2020 at 4:54 am

    Hi, This worked perfectly for a form with less than 1000 responses! Thank you! However, when I started processing for a sheet that has around more than 6000 entries, I always get the “Exceeded maximum execution time” error message. Can you guys help me find a way around this please?

  42. Heemanshu B Shah on May 16, 2020 at 11:31 pm

    Thanks a Lot it has saved me lot time and Energy God bless you and your team. keep up the good work
    regards
    hbshah

  43. Noel on June 12, 2020 at 9:34 pm

    after running the script, it does not populate the urls. how is this happen?

  44. Tyson Wright on July 4, 2020 at 7:32 pm

    I am getting the error SyntaxError: missing ) after argument list (line 4, file “Code.gs”) but don’t see where exactly the error is. I copied the scripts from this and the google doc to try them both out and am getting the same error.

    • Tyson Wright on July 4, 2020 at 9:50 pm

      Figured it out. I had the / at the beginning and end of my form ID that wasn’t suppose to be there. Got rid of those and it worked perfect

  45. Lindsay Corrales on August 3, 2020 at 7:57 am

    I am getting the following error: “SyntaxError: Invalid or unexpected token (line 2, file “Code.gs). I have tried using the form key of both the form preview and the form editing. Please help!

  46. chapelmccullough on August 6, 2020 at 8:01 pm

    I am getting the following error:

    Exception: No item with the given ID could be found. Possibly because you have not edited this item or you do not have permission to access it. (line 2, file “Code”)

    I have changed the permissions of my form to “Anyone with link can edit” but that didn’t resolve the error. Any thoughts as to what else might be the problem?

    • Lenka on November 2, 2020 at 9:29 pm

      I am having this issue as well. Any solution? TY!

  47. Andrea Hansen on September 3, 2020 at 9:45 am

    The code is working beautifully, though, I was wondering if it would be possible to have the Timestamp returned at editing not override the original timestamp but go into a different column. Is this possible…? Thanks!

  48. Micah Strickland on September 7, 2020 at 11:20 am

    You are awesome! Thank you so much~!!

  49. RT on September 18, 2020 at 12:46 am

    Hi, I plan to make a form where the user will define a task and then rate the difficulty. In a later questionnaire I need to import the text (the defined task) as a title or description for the later rating.
    Can that be done?

  50. Glenn Wilkins on September 18, 2020 at 5:27 am

    I think I know what you are asking. There are a bunch of Add-Ons in the Gsuite Market Place that will take Form output and then use it in a document. The add-ons can either be set up in the Google Form or they can be in the Form Responses Sheet. “Form Publisher” will take the form responses and create a document for example. “Form Publisher” can be a bit finicky. There are others that work from the Sheet that work better. Some are free and some require a fee. In Forms, click on the puzzle icon at the top of the screen. In Sheets, click on Add-ons. I have done a ton of cool stuff with Add-ons, mostly for free.

  51. Nourin on October 2, 2020 at 11:24 pm

    i like to edit response of google form but I am unable to do as its showing the message “Sorry, unable to open the file at this time.”, when i click on script editor

  52. thelauramay on October 7, 2020 at 12:08 pm

    You are a total hero!! Thank you!!!!!!!!

  53. Heidi on November 16, 2020 at 10:36 pm

    I’ve been looking for what seems like AGES to edit the responses (my employer restricts us to install the Google Add-ons). Finally I found your instruction and it worked like magic T_T Thank you sooooooooooooo much!!!!!!!!!

  54. Lisa Chacon on November 25, 2020 at 12:25 pm

    You just saved my life. Thank you!

  55. Atul Londhe on December 28, 2020 at 11:18 pm

    Thanks. Great post. You just made my (organization’s) work a lot easier!

  56. Tricia on February 24, 2021 at 10:38 am

    Am I understanding this correctly that if a user who submitted a form wishes to edit their submission, they have to contact the administrator of the form to get the edit URL? Is there a way to provide that URL to the user via email upon submit automatically instead?

  57. Zeke on March 3, 2021 at 6:02 pm

    Please Help
    Error
    Exception: Invalid ID
    assignEditUrls @ Code.gs:2

  58. Peli on March 8, 2021 at 3:42 am

    it said that it is unable to present the file. how should I access edit form again?

  59. tamister1234 on March 17, 2021 at 10:19 am

    Thank you for this!! It works great now!!

  60. Pedro on April 5, 2021 at 4:32 am

    Thank you very much for this article. It works fine and it helped me a lot!

  61. Nel Jasry on April 26, 2021 at 3:38 am

    Hi, thank you for this useful and much needed tutorial.
    I have some problem.

    I have named a wrong column which is already have data, then ran the prog.
    so the url are overwritten at the supposedly an existing data column, the I amend the script, ran it again.

    I got the url at the right column now, but the earlier mistake is still there. i.e. now I have url at two columns.

    How to rectify this?

    TIA.

    • Nel Jasry on April 26, 2021 at 6:19 am

      Continuation/updates of my earlier questions,

      I deleted the url result in response sheet, re-run the to script editor .. yes the url no longer appear at the wrong column, however, the supposed to be original data in that column disappear as well.

      Secondly, I deleted several responses/participants, but they still reappear in the response sheet.

      Thanks again.

  62. jeffrey siy on June 16, 2021 at 12:54 am

    is there a way to exclude a column in the form? I intend to restrict form submission with a password and i don’t want the password to show in the edit link form. thanks in advance

  63. Susan E Canon on June 22, 2021 at 3:12 pm

    I got the script working for new entries into the form. However, I have also copied/pasted results collected separately into the same Google Sheet. They have the same format, timestamp and all – but the script won’t assign URLs to these copied entries.

  64. Rod on August 10, 2021 at 12:33 pm

    Hi there. I’ve run this script before and it worked well. However, I now have created a new form and seem to be having a problem. The script runs without errors, but it does not populate a URL link in the target column. I’ve played with the column number, different variations of the tab name, and have tried with a different form – no success. Any suggestions

  65. Jennifer B on September 1, 2021 at 4:11 pm

    I’ve used this successfully for about two years, but I just added two new entries and the URL will not populate for those two new ones. I’ve run the script and those cells just stay blank. Help?

  66. Peter Hayman on September 7, 2021 at 3:45 am

    thankyou!

  67. user on November 3, 2021 at 10:40 am

    Worked great the first time I ran it. After I closed all documents and filled out a new form and ran the script, it says the script ran with no errors but failed to add the data. Pretty frustrating as I don’t understand what’s failing in the script.

  68. Pradip Birla on February 9, 2022 at 12:05 am

    Not visible script editor under tools then how to enable visible

  69. Glenn on February 9, 2022 at 5:07 am

    Google moved it to Extensions > Apps Scripts

  70. K Mc on March 4, 2022 at 3:26 pm

    The script runs, but populates “undefined” instead of the edit URLs. I’ve gotten the same result with 3 different versions of this script – any ideas what I’m doing wrong? I’m a total newbie – I know just enough about scripts to get myself into trouble. 🙁

  71. JIm J on March 9, 2022 at 7:57 am

    The script complets without errors, but it does not populate a URL link in the target column. I’ve tripled checked everything and still a no go.

    Please advise.

    • Dee A Solberg on July 24, 2022 at 1:33 pm

      I had the same problem. Don’t know if you are still trying, but my problem was still having the first line of “myFunction” in the code, then after removing that making sure the function you want to run is the “assignEditUrls” function (in the top menu after Debug), rather than leaving it set on “myFunction”

  72. Raquel Polanco on April 13, 2022 at 7:27 am

    I was able to add the edit urls. The script worked great! Thanks so much!! What if I receive more submissions after I’ve written the script and need to add the edit urls to those new submissions? Does anyone know how to do this?

  73. Glenn Wilkins on April 13, 2022 at 9:40 am

    You just need to create a trigger that runs the script on form submission.

  74. Maryam akhtar on April 14, 2022 at 8:16 am

    i have error on line 6. getDataRange’ of null

  75. Marcel on May 17, 2022 at 8:25 am

    So now I have an existing data set, for which I would like to generate edit links. (responses were not submitted via the form). So I can use a form to edit the data.
    I’ve checked and set all the datafields to match my form. Also generated timestamps.

    Is this even possible? Or is the only way to submit all my existing data through the form..

  76. Graham on August 4, 2022 at 12:17 pm

    Any Help would be appreciated. I don’t know why I can’t get this to work. I have checked an re-checked, and I continue to get the same error.

    Status:
    – Grabbed the Key from the Edit screen of Form
    – Form is set to allow editing
    – Making the apps script in the same google sheet the responses are located
    – copy/pasted the sheet name (aka, the TAB name, not the work book)
    – Selected the column.

    I just can’t figure it out. I’ve used this exact code on a blank sheet and it works fine. This is a workbook with 800 responses already, and it is not even asking for permission. I succesfully run 2 other scripts in this workbook. Also I have 2 other forms coming into this workbook and dumping in different tabs.

    My Error and Code are below.
    “Exception: You do not have permission to call FormApp.openById. Required permissions: https://www.googleapis.com/auth/forms
    assignEditUrls @ EditURLs.gs:2″

    Code:
    function assignEditUrls() {
    var form = FormApp.openById(’11u8q_r2Ys-Dp_P0AZJldy96s8Ss6_XK1hSaruZlVdsk’);
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(‘Cost Submits Only’);
    var data = sheet.getDataRange().getValues();
    var urlCol = 22;
    var responses = form.getResponses();
    var timestamps = [], urls = [], resultUrls = [];
    for (var i = 0; i < responses.length; i++) {
    timestamps.push(responses[i].getTimestamp().setMilliseconds(0));
    urls.push(responses[i].getEditResponseUrl());
    }
    for (var j = 1; j < data.length; j++) {
    resultUrls.push([data[j][0]?urls[timestamps.indexOf(data[j][0].setMilliseconds(0))]:'']);
    }
    sheet.getRange(2, urlCol, resultUrls.length).setValues(resultUrls);
    }

  77. juraterez on February 26, 2023 at 6:48 am

    FYI, you won’t find the Script Editor the same place. Once you’re in Drive, you’ll need to Click New –> More –> Google Apps Script to open it.

    But the Script DOES work. Yay!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.