I am having a hard time assigning variables to data that I collect in an HTML form for use in Apps Script. My current code collects values from HTML and appends the data to a row in a Google Sheet. What I would like to also do is assign each form value to a variable so I can send automated emails, etc...
What I know so far...
The HTML and script works, it collects values from the form and sends them to code.gs
function addData starts as expected as the values are transferred
The form data is appended to the Google Sheet
Both Code.gs loggers "Confirm received data" and "Received data" log the transferred values
I get an execution error when attempting to assign var columnA that reads: Execution failed: TypeError: Cannot read property "0" from undefined.
Below are logs from the HTML and gs files as well as the Code.gs script I am trying to get to work...
Thank you very much in advance...
console.log:
["20141223", "CraneJe960303", "Jeff", "Crane", "1231231234", "[email protected]", "123 Any St Here, AR 11111", "11111", "19960303", "11-Completed Junior Year", "16-Earned Bachelors Degree", "L-Leadership", 37.****125, -85.****217, 22]
Code.js Logger.log:
Logger.log([Received data: 20141223,CraneJe960303,Jeff,Crane,1231231234,[email protected],123 Any St Here, AR 11111,11111,19960303,11-Completed Junior Year,16-Earned Bachelors Degree,L-Leadership,37.****125,-85.****217,22, []]) [0 seconds]
function addData(data) {
var ss = SpreadsheetApp.openById('1g5N1******************doOnE').getSheetByName('Sheet1');
ss.appendRow(data);
Logger.log('Confirm received data: ' + data);
Logger.log('Received data: ' + data);
var columnA = data.values[0];
Logger.log('Start data value: ' + columnA);
var columnB = data.values[1];
var etc....