I started to use a Google Form recently. I created:
- The Google form with some questions,
- Spreadsheet where the script would put the answers
- An template that would be filled with the answers, converted to PDF and sent to the e-mail address.
Everything works perfectly IF all the Google Form fields had been filled.
If there is at least one field that was left empty - all the answers are put correctly to the spreadsheet but get totally misplaced in the template... (fragment of my code below)
// When Form Gets submitted
function onFormSubmit(e) {
//Get information from form and set as variables
var email_address = "myemail@myemail";
var project_name = e.values[1];
var owner = e.values[2];
var team_members = e.values[5];
var project_initiator = e.values[6];
var stakeholders = e.values[7];
var deadline = e.values[3];
var related_projects = e.values[8];
var deliverables = e.values[4];
var project_summary = e.values[9];
var contribution = e.values[10];
// Replace place holder keys,in our google doc template
copyBody.replaceText('keyProjectName', project_name);
copyBody.replaceText('keyOwner', owner);
copyBody.replaceText('keyTeamMembers', team_members);
copyBody.replaceText('keyProjectInitiator', project_initiator);
copyBody.replaceText('keyStakeholders', stakeholders);
copyBody.replaceText('keyDeadline', deadline);
copyBody.replaceText('keyRelatedProjects', related_projects);
copyBody.replaceText('keyProjectSummary', project_summary);
copyBody.replaceText('keyContribution', contribution);
And a fragment of the template:
http://zapodaj.net/images/ce3895cc6614f.png
Thank you for any advises, answers..