For your script, google.script.run.creeID()
does not return any value. I think this is the cause of your current problem. From Maybe I should use .withSuccessHandler() like it says here, but I don't know how.
, how about using withSuccessHandler()
as follows?
In this case, modify Javascript's ajouter()
as follows.
function ajouter() { const inputs = document.querySelectorAll('input[type="text"]'); google.script.run.withSuccessHandler(tab => { tab = [tab]; for (const input of inputs) { tab.push(input.value); } if (tab.join('') == '') { alert('Le formulaire est vide !'); return; } inputs.forEach(input => input.value = ''); google.script.run.ajouterLigne(tab); }).creeID(); }
tab
is retrieved and the value of tab
and the entered value are appended to the spreadsheet. 李>