I have created a HTML UI for google sheets that allows a user to select 2 variables from dropdowns that then are passed to the Code.gs to execute. What I am observing is that occasionally when a the 'Create' button is pressed the code does not execute!
Is there an issue with using onmouseup in this case or could my problem be something else. It appears like the Google servers are slow to respond and that the variables are not passed when the dialog closes. I have removed the google.script.host.close() code so that the dialog does not close when 'Create' is pressed and it seems to work?? Is there a way of ensuring that the server side code executes?
<hr>
<button onmouseup="closeDia()">Close</button>
<button onmouseup="createSheet()">Create</button>
</div>
<script>
window.closeDia = function() {
google.script.host.close();
};
window.createSheet = function() {
var monthVar = document.getElementById("monthSelect").value;
var yearVar = document.getElementById("yearSelect").value;
google.script.run.duplicateMaster(monthVar,yearVar);
google.script.host.close();
};
</script>