I update a google sheet using a google form, it works fine. I want to add the date of entry automatically: I then created an "onFormSubmit" function using apps script in google sheet, and a trigger "on modification". But the date is not added : the script doesn't look called.
Any idea to debug ?
My modified code :
function onFormSubmit(e) {
console.log("onFormSubmit_",e)
var formSheetName = "Form responses";
var fileName = "Blood pressure";
var file = SpreadsheetApp.getActiveSpreadsheet();
var sheet = file.getSheetByName(formSheetName);
var date = new Date();
var formattedDate = Utilities.formatDate(date, "GMT", "dd/MM/yyyy");
var formattedTime = Utilities.formatDate(date, "GMT", "HH:mm:ss");
var row = [formattedDate, formattedTime];
sheet.appendRow(row);
}
This code works when executed but "is not called by the trigger" when the modifications are made externally by Google Forms : if I change something directly in the sheet the code is called...