Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9768

not working form submit Event Object

$
0
0

I have a Google form which I use to populate a Google docs from a certain template whenever a new response is submitted. In order to achieve this, I have written this script, but it is not working and showing this error TypeError: Cannot read property 'values' of undefined (line 3, file "Code"):

function createdocs(e) {  var Contracttype = e.values[1];  var Partnername = e.values[2];  var Bankname = e.values[3];  var Accountnumber = e.values[4];  var TIN = e.values[5];  var Bankcode = e.values[6];  var Businesscode = e.values[7];  var Phone = e.values[8];  var Director = e.values[9];  var Contractstartingdate = e.values[10];  var Contractendingdate = e.values[11];  var EmailAddress = e.values[12];  var file = DriveApp.getFileById('10lZQhmbocTOmvGwklYnHNvXbdGXDmpbgFbvcnu67G7c');   var folder = DriveApp.getFolderById('1O6QJZ5gRRoSUeolcVvKlMe65Wdb4rz9z')  var copy = file.makeCopy(Partnername +','+ Contractstartingdate, folder);   var doc = DocumentApp.openById(copy.getId());   var body = doc.getBody();   body.replaceText('{{Partner name}}', Partnername);    body.replaceText('{{Bank name}}', Bankname);  body.replaceText('{{Account number}}', Accountnumber);  body.replaceText('{{TIN}}', TIN);  body.replaceText('{{Bank code}}', Bankcode);  body.replaceText('{{Business code}}', Businesscode);  body.replaceText('{{Phone}}', Phone);  body.replaceText('{{Director}}', Director);  body.replaceText('{{Contract starting date}}', Contractstartingdate);  body.replaceText('{{Contract ending date}}', Contractendingdate);  doc.saveAndClose(); }

I have used a youtube tutorial for this purpose and followed every step, But I am failing, how to define values in the script, I have installed the onformSubmit trigger. But there is something going wrong Please help me with this out

enter image description here


Viewing all articles
Browse latest Browse all 9768

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>