I am attempting to post form data to a google spreadsheet. Currently, if the form is validated, then the following occurs:
if (validateForm === true) {
I will show you the EASY WAY to send data to a Google SpreadSheet without AJAX neither Google Form, or PHP...just Google SpreadSheet and HTML or even Android.
You just need two files in the editor a HTML and a Code.gs:
as an example:
Go to File/new HTML name this file=Index.html:
Prueba de Envio de informacion
there are 3 fields to send: EMAIL, CEDULA, NOMBRE
In the same ScriptEditor go to de Code.gs file and type:
function doGet() {
return HtmlService.createHtmlOutputFromFile('Index')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function doSomething(s1,s2,s3){
Logger.log('datos:'+s1+" "+s2+" "+s3);
var enlace="https://docs.google.com/spreadsheets/d/
1XuAXmUeGz2Ffr11R8YZNihLE_HSck9Hf_mRtFSXjWGw/edit";
var ss = SpreadsheetApp.getActiveSpreadsheet();
var ss = SpreadsheetApp.openByUrl(enlace);
var sheet = ss.getSheets()[0];
sheet.appendRow([s1, s2, s3]);
Logger.log(ss.getName());
}
where enlace is the url of your SpreadSheet