0
    function autoFillGoogleDocFromForm(e) {
      var formid = '1S7XslAaB9Mu69t4M68KGtLTdS0ELXNQ_53qYdWodt_Q'
      var timestamp = e.values[0];
      var FullName = e.values[1];
      var file = DriveApp.getFileById('1nnQqsfAbSXu5v8Ma7yuqs6DqEN5d3K32Rqb6F5YbYhc'); 
      var folder = DriveApp.getFolderById('1OJYeBuTiyYsLhFKys_Vm0RQxq7NCW0Ls')
      var copy = file.makeCopy(FullName); 
      var doc = DocumentApp.openById(copy.getId()); 
      var body = doc.getBody(); 
      body.replaceText('<<Full Name>>', FullName); 
      doc.saveAndClose(); 
    }

and when I run this code it's turn

Error   
TypeError: Cannot read properties of undefined (reading 'values')

I don't get it, I've watched the youtube and do exactly the same thing, but it won't work

deadwards
  • 2,109
  • 1
  • 16
  • 27
  • 1
    From your error message of `TypeError: Cannot read properties of undefined (reading 'values')`, I guessed that in your situation, your script might be run without giving the event object `e`. If my understanding is correct, did you directly run your script with the script editor? If it's so, from your showing script, how about executing your script by the onSubmit trigger? [Ref](https://developers.google.com/apps-script/guides/triggers/installable) And also, this thread might be useful. https://stackoverflow.com/q/74109026 – Tanaike Aug 14 '23 at 00:51

0 Answers0